This commit is contained in:
Nexus 2024-09-14 23:23:28 +01:00
parent f96f7978be
commit 9b5571108a

View file

@ -1,8 +1,11 @@
import logging
import niobot
from thefuzz import fuzz
class InfoModule(niobot.Module):
log = logging.getLogger(__name__)
@niobot.command(name="room-info", aliases=["ri"])
async def room_info(self, ctx: niobot.Context, room: str = None):
"""
@ -36,6 +39,7 @@ class InfoModule(niobot.Module):
if ctx.event.sender not in room_obj.users:
continue
ratio = fuzz.ratio(room, room_obj.display_name)
self.log.debug("%r: %r", room_obj.display_name, ratio)
if ratio > 1:
matches.append((room_obj, ratio))
matches.sort(