This commit is contained in:
Xargana 2025-05-09 22:11:53 +03:00
parent c0d5dd5249
commit 40c9d3ffa0
3 changed files with 7 additions and 84 deletions

View file

@ -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