updated gitignore
This commit is contained in:
+13
-31
@@ -67,7 +67,6 @@ async def _resolve_multiword(bot, room_id, tokens):
|
||||
return mxid, candidate
|
||||
else:
|
||||
# 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)
|
||||
matches = []
|
||||
for member in resp.members:
|
||||
@@ -201,7 +200,7 @@ async def handle_command(room, message, bot, prefix, config):
|
||||
"ban": "ban",
|
||||
"unban": "unban",
|
||||
"invite": "invite",
|
||||
"whois": "whois",
|
||||
"userinfo": "whois", # <-- renamed from "whois" to "userinfo"
|
||||
"op": "op",
|
||||
"deop": "deop",
|
||||
"topic": "topic",
|
||||
@@ -239,9 +238,9 @@ async def handle_command(room, message, bot, prefix, config):
|
||||
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:
|
||||
await bot.api.send_text_message(
|
||||
room_id, f"Missing user. Usage: !{cmd} <@user|name> [reason...]"
|
||||
@@ -249,10 +248,6 @@ async def handle_command(room, message, bot, prefix, config):
|
||||
return
|
||||
|
||||
# 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"):
|
||||
# Try to parse last token as power level
|
||||
potential_pl = sub_args[-1]
|
||||
@@ -268,7 +263,7 @@ async def handle_command(room, message, bot, prefix, config):
|
||||
name_tokens = sub_args
|
||||
power = None
|
||||
else:
|
||||
# kick, ban, invite, whois
|
||||
# kick, ban, invite, userinfo
|
||||
name_tokens = sub_args # entire args is the name
|
||||
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}")
|
||||
|
||||
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 ""
|
||||
|
||||
if action == "kick":
|
||||
@@ -350,7 +345,7 @@ async def handle_command(room, message, bot, prefix, config):
|
||||
except Exception as 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:
|
||||
resp = await bot.async_client.joined_members(room_id)
|
||||
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)
|
||||
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
|
||||
@@ -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}")
|
||||
|
||||
# ------------------------------------------------------------
|
||||
# TOPIC
|
||||
# TOPIC, ROOMNAME, AVATAR, MEMBERS, BANS, HELP ...
|
||||
# (unchanged)
|
||||
# ------------------------------------------------------------
|
||||
elif action == "topic":
|
||||
if not sub_args:
|
||||
@@ -407,9 +403,6 @@ async def handle_command(room, message, bot, prefix, config):
|
||||
except Exception as e:
|
||||
await bot.api.send_text_message(room_id, f"❌ Failed: {e}")
|
||||
|
||||
# ------------------------------------------------------------
|
||||
# ROOM NAME
|
||||
# ------------------------------------------------------------
|
||||
elif action == "roomname":
|
||||
if not sub_args:
|
||||
try:
|
||||
@@ -426,9 +419,6 @@ async def handle_command(room, message, bot, prefix, config):
|
||||
except Exception as e:
|
||||
await bot.api.send_text_message(room_id, f"❌ Failed: {e}")
|
||||
|
||||
# ------------------------------------------------------------
|
||||
# AVATAR
|
||||
# ------------------------------------------------------------
|
||||
elif action == "avatar":
|
||||
if not sub_args:
|
||||
try:
|
||||
@@ -448,9 +438,6 @@ async def handle_command(room, message, bot, prefix, config):
|
||||
except Exception as e:
|
||||
await bot.api.send_text_message(room_id, f"❌ Failed: {e}")
|
||||
|
||||
# ------------------------------------------------------------
|
||||
# MEMBERS
|
||||
# ------------------------------------------------------------
|
||||
elif action == "members":
|
||||
try:
|
||||
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:
|
||||
await bot.api.send_text_message(room_id, f"❌ Failed to list members: {e}")
|
||||
|
||||
# ------------------------------------------------------------
|
||||
# BANS
|
||||
# ------------------------------------------------------------
|
||||
elif action == "bans":
|
||||
try:
|
||||
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:
|
||||
await bot.api.send_text_message(room_id, f"❌ Failed to fetch bans: {e}")
|
||||
|
||||
# ------------------------------------------------------------
|
||||
# HELP
|
||||
# ------------------------------------------------------------
|
||||
elif action in ("help", "modhelp"):
|
||||
help_text = """
|
||||
**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
|
||||
- `!unban <@user:domain>` – Unban (full MXID required)
|
||||
- `!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)
|
||||
- `!deop <@user|name>` – Demote user to power level 0
|
||||
- `!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
|
||||
# ------------------------------------------------------------------
|
||||
__version__ = "1.1.0"
|
||||
__version__ = "1.1.1"
|
||||
__author__ = "Funguy Admin"
|
||||
__description__ = "Full room moderation – multi‑word name support"
|
||||
__help__ = """
|
||||
@@ -527,7 +508,8 @@ __help__ = """
|
||||
<summary><strong>Admin / Moderator Commands</strong></summary>
|
||||
<ul>
|
||||
<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>!members</code>, <code>!bans</code></li>
|
||||
<li><code>!admin <action></code> also works as a parent command</li>
|
||||
|
||||
Reference in New Issue
Block a user