updated gitignore

This commit is contained in:
2026-05-07 16:57:33 -05:00
parent 545d4711d8
commit e71a145dea
3 changed files with 13 additions and 32 deletions
-1
View File
@@ -8,6 +8,5 @@ chromedriver
store store
funguybot.service funguybot.service
__pycache__/ __pycache__/
funguy.conf
*.db *.db
plugins/disabled/ plugins/disabled/
+13 -31
View File
@@ -67,7 +67,6 @@ async def _resolve_multiword(bot, room_id, tokens):
return mxid, candidate return mxid, candidate
else: else:
# Duplicate display name → fall through to ambiguity handling # Duplicate display name → fall through to ambiguity handling
# We'll fetch the real members for this candidate and raise UserResolutionError
resp = await bot.async_client.joined_members(room_id) resp = await bot.async_client.joined_members(room_id)
matches = [] matches = []
for member in resp.members: for member in resp.members:
@@ -201,7 +200,7 @@ async def handle_command(room, message, bot, prefix, config):
"ban": "ban", "ban": "ban",
"unban": "unban", "unban": "unban",
"invite": "invite", "invite": "invite",
"whois": "whois", "userinfo": "whois", # <-- renamed from "whois" to "userinfo"
"op": "op", "op": "op",
"deop": "deop", "deop": "deop",
"topic": "topic", "topic": "topic",
@@ -239,9 +238,9 @@ async def handle_command(room, message, bot, prefix, config):
sub_args = args sub_args = args
# ------------------------------------------------------------ # ------------------------------------------------------------
# User-targeting actions # User-targeting actions (kick, ban, invite, userinfo, op, deop)
# ------------------------------------------------------------ # ------------------------------------------------------------
if action in ("kick", "ban", "invite", "whois", "op", "deop"): if action in ("kick", "ban", "invite", "userinfo", "op", "deop"):
if not sub_args: if not sub_args:
await bot.api.send_text_message( await bot.api.send_text_message(
room_id, f"Missing user. Usage: !{cmd} <@user|name> [reason...]" room_id, f"Missing user. Usage: !{cmd} <@user|name> [reason...]"
@@ -249,10 +248,6 @@ async def handle_command(room, message, bot, prefix, config):
return return
# For op/deop, the last token might be a power level (number) # For op/deop, the last token might be a power level (number)
# For kick/ban, everything after the name is the reason.
# Strategy: Try progressively longer multi-word names from the start of sub_args.
# For op: if the very last token is a pure integer, it's a power level; rest is the name.
# For kick/ban: everything is name except we can't know the boundary, so just try the whole thing.
if action in ("op", "deop"): if action in ("op", "deop"):
# Try to parse last token as power level # Try to parse last token as power level
potential_pl = sub_args[-1] potential_pl = sub_args[-1]
@@ -268,7 +263,7 @@ async def handle_command(room, message, bot, prefix, config):
name_tokens = sub_args name_tokens = sub_args
power = None power = None
else: else:
# kick, ban, invite, whois # kick, ban, invite, userinfo
name_tokens = sub_args # entire args is the name name_tokens = sub_args # entire args is the name
power = None power = None
@@ -326,7 +321,7 @@ async def handle_command(room, message, bot, prefix, config):
await bot.api.send_text_message(room_id, f"❌ Failed to set power: {e}") await bot.api.send_text_message(room_id, f"❌ Failed to set power: {e}")
else: else:
# For kick/ban/invite: reason is everything after the name tokens # For kick/ban/invite/userinfo: reason is everything after the name tokens
reason = " ".join(sub_args[len(name_tokens):]) if len(sub_args) > len(name_tokens) else "" reason = " ".join(sub_args[len(name_tokens):]) if len(sub_args) > len(name_tokens) else ""
if action == "kick": if action == "kick":
@@ -350,7 +345,7 @@ async def handle_command(room, message, bot, prefix, config):
except Exception as e: except Exception as e:
await bot.api.send_text_message(room_id, f"❌ Failed to invite: {e}") await bot.api.send_text_message(room_id, f"❌ Failed to invite: {e}")
elif action == "whois": elif action == "userinfo": # <-- was "whois", now "userinfo"
try: try:
resp = await bot.async_client.joined_members(room_id) resp = await bot.async_client.joined_members(room_id)
member_info = None member_info = None
@@ -367,7 +362,7 @@ async def handle_command(room, message, bot, prefix, config):
) )
await bot.api.send_text_message(room_id, msg) await bot.api.send_text_message(room_id, msg)
except Exception as e: except Exception as e:
await bot.api.send_text_message(room_id, f"❌ Failed to get whois: {e}") await bot.api.send_text_message(room_id, f"❌ Failed to get userinfo: {e}")
# ------------------------------------------------------------ # ------------------------------------------------------------
# UNBAN # UNBAN
@@ -389,7 +384,8 @@ async def handle_command(room, message, bot, prefix, config):
await bot.api.send_text_message(room_id, f"❌ Failed to unban: {e}") await bot.api.send_text_message(room_id, f"❌ Failed to unban: {e}")
# ------------------------------------------------------------ # ------------------------------------------------------------
# TOPIC # TOPIC, ROOMNAME, AVATAR, MEMBERS, BANS, HELP ...
# (unchanged)
# ------------------------------------------------------------ # ------------------------------------------------------------
elif action == "topic": elif action == "topic":
if not sub_args: if not sub_args:
@@ -407,9 +403,6 @@ async def handle_command(room, message, bot, prefix, config):
except Exception as e: except Exception as e:
await bot.api.send_text_message(room_id, f"❌ Failed: {e}") await bot.api.send_text_message(room_id, f"❌ Failed: {e}")
# ------------------------------------------------------------
# ROOM NAME
# ------------------------------------------------------------
elif action == "roomname": elif action == "roomname":
if not sub_args: if not sub_args:
try: try:
@@ -426,9 +419,6 @@ async def handle_command(room, message, bot, prefix, config):
except Exception as e: except Exception as e:
await bot.api.send_text_message(room_id, f"❌ Failed: {e}") await bot.api.send_text_message(room_id, f"❌ Failed: {e}")
# ------------------------------------------------------------
# AVATAR
# ------------------------------------------------------------
elif action == "avatar": elif action == "avatar":
if not sub_args: if not sub_args:
try: try:
@@ -448,9 +438,6 @@ async def handle_command(room, message, bot, prefix, config):
except Exception as e: except Exception as e:
await bot.api.send_text_message(room_id, f"❌ Failed: {e}") await bot.api.send_text_message(room_id, f"❌ Failed: {e}")
# ------------------------------------------------------------
# MEMBERS
# ------------------------------------------------------------
elif action == "members": elif action == "members":
try: try:
resp = await bot.async_client.joined_members(room_id) resp = await bot.async_client.joined_members(room_id)
@@ -472,9 +459,6 @@ async def handle_command(room, message, bot, prefix, config):
except Exception as e: except Exception as e:
await bot.api.send_text_message(room_id, f"❌ Failed to list members: {e}") await bot.api.send_text_message(room_id, f"❌ Failed to list members: {e}")
# ------------------------------------------------------------
# BANS
# ------------------------------------------------------------
elif action == "bans": elif action == "bans":
try: try:
banned = await get_banned_users(bot, room_id) banned = await get_banned_users(bot, room_id)
@@ -486,9 +470,6 @@ async def handle_command(room, message, bot, prefix, config):
except Exception as e: except Exception as e:
await bot.api.send_text_message(room_id, f"❌ Failed to fetch bans: {e}") await bot.api.send_text_message(room_id, f"❌ Failed to fetch bans: {e}")
# ------------------------------------------------------------
# HELP
# ------------------------------------------------------------
elif action in ("help", "modhelp"): elif action in ("help", "modhelp"):
help_text = """ help_text = """
**Moderator Commands (standalone or via !admin):** **Moderator Commands (standalone or via !admin):**
@@ -496,7 +477,7 @@ async def handle_command(room, message, bot, prefix, config):
- `!ban <@user|name> [reason]` Ban a user - `!ban <@user|name> [reason]` Ban a user
- `!unban <@user:domain>` Unban (full MXID required) - `!unban <@user:domain>` Unban (full MXID required)
- `!invite <@user|name>` Invite a user - `!invite <@user|name>` Invite a user
- `!whois <@user|name>` Show user details & power level - `!userinfo <@user|name>` Show user details & power level (was `!whois`)
- `!op <@user|name> [pl=50]` Promote user (max 50, moderator) - `!op <@user|name> [pl=50]` Promote user (max 50, moderator)
- `!deop <@user|name>` Demote user to power level 0 - `!deop <@user|name>` Demote user to power level 0
- `!topic [new topic]` Show / set room topic - `!topic [new topic]` Show / set room topic
@@ -519,7 +500,7 @@ If the name is ambiguous you'll be asked to choose from a numbered list.
# ------------------------------------------------------------------ # ------------------------------------------------------------------
# Plugin metadata # Plugin metadata
# ------------------------------------------------------------------ # ------------------------------------------------------------------
__version__ = "1.1.0" __version__ = "1.1.1"
__author__ = "Funguy Admin" __author__ = "Funguy Admin"
__description__ = "Full room moderation multiword name support" __description__ = "Full room moderation multiword name support"
__help__ = """ __help__ = """
@@ -527,7 +508,8 @@ __help__ = """
<summary><strong>Admin / Moderator Commands</strong></summary> <summary><strong>Admin / Moderator Commands</strong></summary>
<ul> <ul>
<li><code>!kick</code>, <code>!ban</code>, <code>!unban</code>, <code>!invite</code></li> <li><code>!kick</code>, <code>!ban</code>, <code>!unban</code>, <code>!invite</code></li>
<li><code>!op</code> (max PL 50), <code>!deop</code>, <code>!whois</code></li> <li><code>!userinfo</code> Show user details & power level (was !whois)</li>
<li><code>!op</code> (max PL 50), <code>!deop</code></li>
<li><code>!topic</code>, <code>!roomname</code>, <code>!avatar</code></li> <li><code>!topic</code>, <code>!roomname</code>, <code>!avatar</code></li>
<li><code>!members</code>, <code>!bans</code></li> <li><code>!members</code>, <code>!bans</code></li>
<li><code>!admin &lt;action&gt;</code> also works as a parent command</li> <li><code>!admin &lt;action&gt;</code> also works as a parent command</li>
BIN
View File
Binary file not shown.