Merge remote-tracking branch 'origin/main'
This commit is contained in:
commit
a667d4f701
6 changed files with 303 additions and 99 deletions
|
|
@ -62,4 +62,70 @@ class AdminCommands:
|
|||
save_tracked_channels(self.bot.tracked_channels)
|
||||
await message.reply(f"Stopped tracking messages in {message.channel.name}.", silent=True)
|
||||
else:
|
||||
await message.reply("This channel is not being tracked.", silent=True)
|
||||
await message.reply("This channel is not being tracked.", silent=True)
|
||||
|
||||
async def cmd_loadcog(self, message):
|
||||
"""
|
||||
Load a cog
|
||||
Usage: .loadcog <cog_name>
|
||||
"""
|
||||
content = message.content.strip()
|
||||
parts = content.split()
|
||||
|
||||
if len(parts) != 2:
|
||||
await message.edit(content="❌ Usage: `.loadcog <cog_name>`")
|
||||
return
|
||||
|
||||
cog_name = parts[1]
|
||||
if self.bot.cog_manager.load_cog(cog_name):
|
||||
await message.edit(content=f"✅ Loaded cog: `{cog_name}`")
|
||||
else:
|
||||
await message.edit(content=f"❌ Failed to load cog: `{cog_name}`")
|
||||
|
||||
async def cmd_unloadcog(self, message):
|
||||
"""
|
||||
Unload a cog
|
||||
Usage: .unloadcog <cog_name>
|
||||
"""
|
||||
content = message.content.strip()
|
||||
parts = content.split()
|
||||
|
||||
if len(parts) != 2:
|
||||
await message.edit(content="❌ Usage: `.unloadcog <cog_name>`")
|
||||
return
|
||||
|
||||
cog_name = parts[1]
|
||||
if self.bot.cog_manager.unload_cog(cog_name):
|
||||
await message.edit(content=f"✅ Unloaded cog: `{cog_name}`")
|
||||
else:
|
||||
await message.edit(content=f"❌ Failed to unload cog: `{cog_name}`")
|
||||
|
||||
async def cmd_reloadcog(self, message):
|
||||
"""
|
||||
Reload a cog
|
||||
Usage: .reloadcog <cog_name>
|
||||
"""
|
||||
content = message.content.strip()
|
||||
parts = content.split()
|
||||
|
||||
if len(parts) != 2:
|
||||
await message.edit(content="❌ Usage: `.reloadcog <cog_name>`")
|
||||
return
|
||||
|
||||
cog_name = parts[1]
|
||||
if self.bot.cog_manager.reload_cog(cog_name):
|
||||
await message.edit(content=f"✅ Reloaded cog: `{cog_name}`")
|
||||
else:
|
||||
await message.edit(content=f"❌ Failed to reload cog: `{cog_name}`")
|
||||
|
||||
async def cmd_listcogs(self, message):
|
||||
"""
|
||||
List all loaded cogs
|
||||
Usage: .listcogs
|
||||
"""
|
||||
if not self.bot.cog_manager.cogs:
|
||||
await message.edit(content="No cogs are currently loaded.")
|
||||
return
|
||||
|
||||
cog_list = "\n".join(f"• {name}" for name in sorted(self.bot.cog_manager.cogs.keys()))
|
||||
await message.edit(content=f"**Loaded Cogs:**\n{cog_list}")
|
||||
|
|
@ -4,37 +4,6 @@ import asyncio
|
|||
class UserManagementCommands:
|
||||
def __init__(self, bot):
|
||||
self.bot = bot
|
||||
# Store lists of ignored/muted users and channels
|
||||
self.ignored_channels = set()
|
||||
self.muted_channels = set()
|
||||
self.muted_users = set()
|
||||
|
||||
async def cmd_ignore(self, message):
|
||||
"""
|
||||
Ignore all users in the current channel except for self
|
||||
Usage: .ignore
|
||||
"""
|
||||
try:
|
||||
channel_id = message.channel.id
|
||||
self.ignored_channels.add(channel_id)
|
||||
await message.edit(content=f"✅ Ignoring users in this channel. Use `.unignore` to revert.")
|
||||
except Exception as e:
|
||||
await message.edit(content=f"❌ Error ignoring channel: {str(e)}")
|
||||
|
||||
async def cmd_unignore(self, message):
|
||||
"""
|
||||
Stop ignoring users in the current channel
|
||||
Usage: .unignore
|
||||
"""
|
||||
try:
|
||||
channel_id = message.channel.id
|
||||
if channel_id in self.ignored_channels:
|
||||
self.ignored_channels.remove(channel_id)
|
||||
await message.edit(content=f"✅ No longer ignoring users in this channel.")
|
||||
else:
|
||||
await message.edit(content=f"❌ This channel is not being ignored.")
|
||||
except Exception as e:
|
||||
await message.edit(content=f"❌ Error: {str(e)}")
|
||||
|
||||
async def cmd_close(self, message):
|
||||
"""
|
||||
|
|
@ -52,36 +21,9 @@ class UserManagementCommands:
|
|||
except Exception as e:
|
||||
await message.edit(content=f"❌ Error closing DM: {str(e)}")
|
||||
|
||||
async def cmd_mute(self, message):
|
||||
"""
|
||||
Mute the current channel (no notifications)
|
||||
Usage: .mute
|
||||
"""
|
||||
try:
|
||||
channel_id = message.channel.id
|
||||
self.muted_channels.add(channel_id)
|
||||
await message.edit(content=f"✅ Channel muted. Use `.unmute` to revert.")
|
||||
except Exception as e:
|
||||
await message.edit(content=f"❌ Error muting channel: {str(e)}")
|
||||
|
||||
async def cmd_unmute(self, message):
|
||||
"""
|
||||
Unmute the current channel
|
||||
Usage: .unmute
|
||||
"""
|
||||
try:
|
||||
channel_id = message.channel.id
|
||||
if channel_id in self.muted_channels:
|
||||
self.muted_channels.remove(channel_id)
|
||||
await message.edit(content=f"✅ Channel unmuted.")
|
||||
else:
|
||||
await message.edit(content=f"❌ This channel is not muted.")
|
||||
except Exception as e:
|
||||
await message.edit(content=f"❌ Error: {str(e)}")
|
||||
|
||||
async def cmd_block(self, message):
|
||||
"""
|
||||
Block a user
|
||||
Block a user using Discord's native block function
|
||||
Usage: .block @user or .block [in reply to a message]
|
||||
"""
|
||||
try:
|
||||
|
|
@ -99,7 +41,7 @@ class UserManagementCommands:
|
|||
return
|
||||
|
||||
await user.block()
|
||||
await message.edit(content=f"✅ Blocked user {user.name}#{user.discriminator}.")
|
||||
await message.edit(content=f"✅ Blocked {user.name}#{user.discriminator}")
|
||||
except Exception as e:
|
||||
await message.edit(content=f"❌ Error blocking user: {str(e)}")
|
||||
|
||||
|
|
@ -139,4 +81,4 @@ class UserManagementCommands:
|
|||
|
||||
# Method to check if a channel is muted
|
||||
def is_channel_muted(self, channel_id):
|
||||
return channel_id in self.muted_channels
|
||||
return channel_id in self.muted_channels
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue