Hotfix | Removed emojis

This commit is contained in:
Charlie 2026-01-28 16:30:24 +13:00
parent b8717f0996
commit cd3621ec88
6 changed files with 128 additions and 134 deletions

View file

@ -1,8 +1,2 @@
# booly # Booly
Revamped tooly designed for ease of use.
two use modes:
1. premade *servers may lag
2. host your self it comes with the whole bot all you need is a token and a host
you can fork expand pull request host just but this in the readme or site ![Powered by Booly](https://img.shields.io/github/v/release/chersbobers/booly?label=powered%20by%20booly&color=5865F2&logo=discord&logoColor=white)

28
bot.py
View file

@ -82,12 +82,12 @@ class MyBot(commands.Bot):
await self.load_extension('cogs.fun') await self.load_extension('cogs.fun')
await self.tree.sync() await self.tree.sync()
logger.info('All cogs loaded and commands synced!') logger.info('All cogs loaded and commands synced!')
bot = MyBot() bot = MyBot()
async def health_check(request): async def health_check(request):
return web.Response(text="Bot is running!") return web.Response(text="Bot is running!")
async def start_web_server(): async def start_web_server():
app = web.Application() app = web.Application()
@ -100,46 +100,46 @@ async def start_web_server():
port = int(os.getenv('PORT', 8080)) port = int(os.getenv('PORT', 8080))
site = web.TCPSite(runner, '0.0.0.0', port) site = web.TCPSite(runner, '0.0.0.0', port)
await site.start() await site.start()
logger.info(f'🌐 Health check server running on port {port}') logger.info(f'Health check server running on port {port}')
@bot.event @bot.event
async def on_ready(): async def on_ready():
asyncio.create_task(start_web_server()) asyncio.create_task(start_web_server())
logger.info(f'Logged in as {bot.user}') logger.info(f'Logged in as {bot.user}')
logger.info(f'📊 Connected to {len(bot.guilds)} guilds') logger.info(f'Connected to {len(bot.guilds)} guilds')
await bot.change_presence(activity=discord.Game(name="/help")) await bot.change_presence(activity=discord.Game(name="/help"))
logger.info('🚀 All systems operational!') logger.info('All systems operational!')
@bot.tree.command(name='help', description='Show all available commands') @bot.tree.command(name='help', description='Show all available commands')
async def help_command(interaction: discord.Interaction): async def help_command(interaction: discord.Interaction):
embed = discord.Embed( embed = discord.Embed(
title='🤖 Bot Commands', title='Bot Commands',
description='Here are all the slash commands you can use!', description='Here are all the slash commands you can use!',
color=0x5865F2 color=0x5865F2
) )
embed.add_field( embed.add_field(
name='📊 Leveling & Economy', name='Leveling & Economy',
value='`/rank` - View your rank\n`/leaderboard` - Top 10 users\n`/balance` - Check balance\n`/daily` - Daily reward\n`/work` - Work for coins', value='`/rank` - View your rank\n`/leaderboard` - Top 10 users\n`/balance` - Check balance\n`/daily` - Daily reward\n`/work` - Work for coins',
inline=False inline=False
) )
embed.add_field( embed.add_field(
name='🎮 Fun', name='Fun',
value='`/8ball` - Magic 8ball\n`/roll` - Roll dice\n`/flip` - Flip coin\n`/cat` - Random cat\n`/dog` - Random dog', value='`/8ball` - Magic 8ball\n`/roll` - Roll dice\n`/flip` - Flip coin\n`/cat` - Random cat\n`/dog` - Random dog',
inline=False inline=False
) )
embed.add_field( embed.add_field(
name='🛡️ System & Moderation', name='System & Moderation',
value='`/kick` - Kick member\n`/ban` - Ban member\n`/unban` - Unban user\n`/timeout` - Timeout member\n`/warn` - Warn member\n`/warnings` - View warnings\n`/clearwarnings` - Clear warnings\n`/purge` - Delete messages\n`/lock` - Lock channel\n`/unlock` - Unlock channel', value='`/kick` - Kick member\n`/ban` - Ban member\n`/unban` - Unban user\n`/timeout` - Timeout member\n`/warn` - Warn member\n`/warnings` - View warnings\n`/clearwarnings` - Clear warnings\n`/purge` - Delete messages\n`/lock` - Lock channel\n`/unlock` - Unlock channel',
inline=False inline=False
) )
embed.add_field( embed.add_field(
name='🎭 Reaction Roles & YouTube', name='Reaction Roles & YouTube',
value='`/reactionrole` - Create reaction role\n`/removereactionrole` - Remove reaction role\n`/listreactionroles` - List reaction roles\n`/createreactionpanel` - Create panel\n`/setupyoutube` - Setup YouTube\n`/toggleyoutube` - Toggle YouTube\n`/youtubestatus` - YouTube status\n`/testlastvideo` - Test video', value='`/reactionrole` - Create reaction role\n`/removereactionrole` - Remove reaction role\n`/listreactionroles` - List reaction roles\n`/createreactionpanel` - Create panel\n`/setupyoutube` - Setup YouTube\n`/toggleyoutube` - Toggle YouTube\n`/youtubestatus` - YouTube status\n`/testlastvideo` - Test video',
inline=False inline=False
) )
embed.add_field( embed.add_field(
name=' Info', name='Info',
value='`/ping` - Bot latency\n`/serverinfo` - Server info\n`/userinfo` - User info', value='`/ping` - Bot latency\n`/serverinfo` - Server info\n`/userinfo` - User info',
inline=False inline=False
) )
@ -148,9 +148,9 @@ async def help_command(interaction: discord.Interaction):
if __name__ == '__main__': if __name__ == '__main__':
token = os.getenv('DISCORD_TOKEN') token = os.getenv('DISCORD_TOKEN')
if not token: if not token:
logger.error('DISCORD_TOKEN not set!') logger.error('DISCORD_TOKEN not set!')
exit(1) exit(1)
logger.info("everythings working") logger.info("everythings working")
logger.info('hello from chersbobers and booly co :3') logger.info('hello from chersbobers and booly co :3')
bot.run(token) bot.run(token)

View file

@ -14,7 +14,7 @@ class Economy(commands.Cog):
user_data = self.bot.db.get_user(str(interaction.guild.id), str(target.id)) user_data = self.bot.db.get_user(str(interaction.guild.id), str(target.id))
embed = discord.Embed( embed = discord.Embed(
title='💰 Balance', title='Balance',
description=f'{target.mention} has **{user_data["coins"]:,}** coins in wallet and **{user_data["bank"]:,}** in bank!\n**Total:** {user_data["coins"] + user_data["bank"]:,} coins', description=f'{target.mention} has **{user_data["coins"]:,}** coins in wallet and **{user_data["bank"]:,}** in bank!\n**Total:** {user_data["coins"] + user_data["bank"]:,} coins',
color=0xFFD700 color=0xFFD700
) )
@ -28,7 +28,7 @@ class Economy(commands.Cog):
if now - user_data['last_daily'] < 86400: if now - user_data['last_daily'] < 86400:
time_left = 86400 - (now - user_data['last_daily']) time_left = 86400 - (now - user_data['last_daily'])
hours = int(time_left / 3600) hours = int(time_left / 3600)
await interaction.response.send_message(f'You already claimed your daily! Come back in {hours} hours.', ephemeral=True) await interaction.response.send_message(f'You already claimed your daily! Come back in {hours} hours.', ephemeral=True)
return return
reward = 100 reward = 100
@ -36,7 +36,7 @@ class Economy(commands.Cog):
user_data['last_daily'] = now user_data['last_daily'] = now
self.bot.db.set_user(str(interaction.guild.id), str(interaction.user.id), user_data) self.bot.db.set_user(str(interaction.guild.id), str(interaction.user.id), user_data)
await interaction.response.send_message(f'You claimed your daily reward of **{reward:,}** coins!\n💰 New balance: **{user_data["coins"]:,}** coins') await interaction.response.send_message(f'You claimed your daily reward of **{reward:,}** coins!\n💰 New balance: **{user_data["coins"]:,}** coins')
@app_commands.command(name='work', description='Work to earn coins') @app_commands.command(name='work', description='Work to earn coins')
async def work(self, interaction: discord.Interaction): async def work(self, interaction: discord.Interaction):
@ -46,7 +46,7 @@ class Economy(commands.Cog):
if now - user_data['last_work'] < 3600: if now - user_data['last_work'] < 3600:
time_left = 3600 - (now - user_data['last_work']) time_left = 3600 - (now - user_data['last_work'])
minutes = int(time_left / 60) minutes = int(time_left / 60)
await interaction.response.send_message(f'You need to rest! Come back in {minutes} minutes.', ephemeral=True) await interaction.response.send_message(f'You need to rest! Come back in {minutes} minutes.', ephemeral=True)
return return
earnings = random.randint(10, 50) earnings = random.randint(10, 50)
@ -63,7 +63,7 @@ class Economy(commands.Cog):
'You tutored students and earned' 'You tutored students and earned'
] ]
await interaction.response.send_message(f'💼 {random.choice(jobs)} **{earnings:,}** coins!\n💰 New balance: **{user_data["coins"]:,}** coins') await interaction.response.send_message(f'{random.choice(jobs)} **{earnings:,}** coins!\n💰 New balance: **{user_data["coins"]:,}** coins')
async def setup(bot): async def setup(bot):
await bot.add_cog(Economy(bot)) await bot.add_cog(Economy(bot))

View file

@ -16,20 +16,20 @@ class Fun(commands.Cog):
'Reply hazy, try again.', 'Ask again later.', 'Better not tell you now.', 'Reply hazy, try again.', 'Ask again later.', 'Better not tell you now.',
'Cannot predict now.', "Don't count on it.", 'My reply is no.', 'Very doubtful.' 'Cannot predict now.', "Don't count on it.", 'My reply is no.', 'Very doubtful.'
] ]
await interaction.response.send_message(f'🔮 **{question}**\n{random.choice(responses)}') await interaction.response.send_message(f' **{question}**\n{random.choice(responses)}')
@app_commands.command(name='roll', description='Roll a dice') @app_commands.command(name='roll', description='Roll a dice')
async def roll(self, interaction: discord.Interaction, sides: int = 6): async def roll(self, interaction: discord.Interaction, sides: int = 6):
if sides < 2 or sides > 100: if sides < 2 or sides > 100:
await interaction.response.send_message('Dice must have between 2 and 100 sides!', ephemeral=True) await interaction.response.send_message('Dice must have between 2 and 100 sides!', ephemeral=True)
return return
result = random.randint(1, sides) result = random.randint(1, sides)
await interaction.response.send_message(f'🎲 You rolled a **{result}** (1-{sides})') await interaction.response.send_message(f' You rolled a **{result}** (1-{sides})')
@app_commands.command(name='flip', description='Flip a coin') @app_commands.command(name='flip', description='Flip a coin')
async def flip(self, interaction: discord.Interaction): async def flip(self, interaction: discord.Interaction):
result = random.choice(['Heads', 'Tails']) result = random.choice(['Heads', 'Tails'])
await interaction.response.send_message(f'🪙 The coin landed on **{result}**!') await interaction.response.send_message(f'The coin landed on **{result}**!')
@app_commands.command(name='cat', description='Get a random cat picture') @app_commands.command(name='cat', description='Get a random cat picture')
async def cat(self, interaction: discord.Interaction): async def cat(self, interaction: discord.Interaction):
@ -38,12 +38,12 @@ class Fun(commands.Cog):
try: try:
async with session.get('https://api.thecatapi.com/v1/images/search') as resp: async with session.get('https://api.thecatapi.com/v1/images/search') as resp:
data = await resp.json() data = await resp.json()
embed = discord.Embed(title='🐱 Random Kitty!', color=0xFF69B4) embed = discord.Embed(title='Random Kitty!', color=0xFF69B4)
embed.set_image(url=data[0]['url']) embed.set_image(url=data[0]['url'])
embed.set_footer(text=f'Requested by {interaction.user.name}') embed.set_footer(text=f'Requested by {interaction.user.name}')
await interaction.followup.send(embed=embed) await interaction.followup.send(embed=embed)
except: except:
await interaction.followup.send('Failed to fetch a cat picture 😿') await interaction.followup.send('Failed to fetch a cat picture ')
@app_commands.command(name='dog', description='Get a random dog picture') @app_commands.command(name='dog', description='Get a random dog picture')
async def dog(self, interaction: discord.Interaction): async def dog(self, interaction: discord.Interaction):
@ -52,12 +52,12 @@ class Fun(commands.Cog):
try: try:
async with session.get('https://api.thedogapi.com/v1/images/search') as resp: async with session.get('https://api.thedogapi.com/v1/images/search') as resp:
data = await resp.json() data = await resp.json()
embed = discord.Embed(title='🐶 Random Doggy!', color=0xFF69B4) embed = discord.Embed(title='Random Doggy!', color=0xFF69B4)
embed.set_image(url=data[0]['url']) embed.set_image(url=data[0]['url'])
embed.set_footer(text=f'Requested by {interaction.user.name}') embed.set_footer(text=f'Requested by {interaction.user.name}')
await interaction.followup.send(embed=embed) await interaction.followup.send(embed=embed)
except: except:
await interaction.followup.send('Failed to fetch a dog picture 😥') await interaction.followup.send('Failed to fetch a dog picture ')
async def setup(bot): async def setup(bot):
await bot.add_cog(Fun(bot)) await bot.add_cog(Fun(bot))

View file

@ -30,13 +30,13 @@ class Leveling(commands.Cog):
user_data['coins'] += coin_reward user_data['coins'] += coin_reward
messages = [ messages = [
f'🎉 GG {message.author.mention}! You leveled up to **Level {user_data["level"]}**!', f'gg {message.author.mention}! You leveled up to **Level {user_data["level"]}**!',
f'Congrats {message.author.mention}! You\'re now **Level {user_data["level"]}**!', f'Congrats {message.author.mention}! You\'re now **Level {user_data["level"]}**!',
f'🚀 Level up! {message.author.mention} reached **Level {user_data["level"]}**!' f'Level up! {message.author.mention} reached **Level {user_data["level"]}**!'
] ]
await message.channel.send( await message.channel.send(
f'{random.choice(messages)} You earned **{coin_reward:,} coins**! 💰' f'{random.choice(messages)} You earned **{coin_reward:,} coins**! '
) )
self.bot.db.set_user(str(message.guild.id), str(message.author.id), user_data) self.bot.db.set_user(str(message.guild.id), str(message.author.id), user_data)
@ -64,7 +64,7 @@ class Leveling(commands.Cog):
`{bar}` `{bar}`
**💰 BALANCE** {user_data['coins']:,} coins **BALANCE** {user_data['coins']:,} coins
""" """
embed.set_thumbnail(url=target.display_avatar.url) embed.set_thumbnail(url=target.display_avatar.url)
await interaction.response.send_message(embed=embed) await interaction.response.send_message(embed=embed)
@ -82,7 +82,7 @@ class Leveling(commands.Cog):
) )
embed = discord.Embed( embed = discord.Embed(
title='🏆 Server Leaderboard', title='Server Leaderboard',
description='\n'.join(description) if description else 'No users yet!', description='\n'.join(description) if description else 'No users yet!',
color=0x9B59B6, color=0x9B59B6,
timestamp=datetime.utcnow() timestamp=datetime.utcnow()

View file

@ -45,7 +45,7 @@ class System(commands.Cog):
continue continue
embed = discord.Embed( embed = discord.Embed(
title='🎬 New YouTube Video!', title='New YouTube Video!',
description=f'**{latest.title}**', description=f'**{latest.title}**',
url=latest.link, url=latest.link,
color=0xFF0000, color=0xFF0000,
@ -60,14 +60,14 @@ class System(commands.Cog):
if hasattr(latest, 'published'): if hasattr(latest, 'published'):
embed.add_field(name='Published', value=latest.published, inline=True) embed.add_field(name='Published', value=latest.published, inline=True)
await channel.send('📺 New video alert! @everyone', embed=embed) await channel.send('New video alert! @everyone', embed=embed)
logger.info(f'📺 Sent notification for: {latest.title}') logger.info(f'Sent notification for: {latest.title}')
settings['last_video_id'] = video_id settings['last_video_id'] = video_id
self.bot.db.save() self.bot.db.save()
except Exception as e: except Exception as e:
logger.error(f'Error checking YouTube: {e}') logger.error(f'Error checking YouTube: {e}')
@check_youtube.before_loop @check_youtube.before_loop
async def before_check_youtube(self): async def before_check_youtube(self):
@ -76,14 +76,14 @@ class System(commands.Cog):
@app_commands.command(name='ping', description='Check bot latency') @app_commands.command(name='ping', description='Check bot latency')
async def ping(self, interaction: discord.Interaction): async def ping(self, interaction: discord.Interaction):
latency = round(self.bot.latency * 1000) latency = round(self.bot.latency * 1000)
await interaction.response.send_message(f'🏓 Pong! Latency: `{latency}ms`') await interaction.response.send_message(f'Pong! Latency: `{latency}ms`')
@app_commands.command(name='serverinfo', description='Display server information') @app_commands.command(name='serverinfo', description='Display server information')
async def serverinfo(self, interaction: discord.Interaction): async def serverinfo(self, interaction: discord.Interaction):
guild = interaction.guild guild = interaction.guild
embed = discord.Embed( embed = discord.Embed(
title=f'📊 {guild.name}', title=f'{guild.name}',
color=0x5865F2, color=0x5865F2,
timestamp=datetime.utcnow() timestamp=datetime.utcnow()
) )
@ -91,12 +91,12 @@ class System(commands.Cog):
if guild.icon: if guild.icon:
embed.set_thumbnail(url=guild.icon.url) embed.set_thumbnail(url=guild.icon.url)
embed.add_field(name='👑 Owner', value=guild.owner.mention, inline=True) embed.add_field(name='Owner', value=guild.owner.mention, inline=True)
embed.add_field(name='👥 Members', value=guild.member_count, inline=True) embed.add_field(name='Members', value=guild.member_count, inline=True)
embed.add_field(name='📅 Created', value=guild.created_at.strftime('%Y-%m-%d'), inline=True) embed.add_field(name='Created', value=guild.created_at.strftime('%Y-%m-%d'), inline=True)
embed.add_field(name='💬 Channels', value=len(guild.channels), inline=True) embed.add_field(name='Channels', value=len(guild.channels), inline=True)
embed.add_field(name='😀 Emojis', value=len(guild.emojis), inline=True) embed.add_field(name='Emojis', value=len(guild.emojis), inline=True)
embed.add_field(name='🎭 Roles', value=len(guild.roles), inline=True) embed.add_field(name='Roles', value=len(guild.roles), inline=True)
await interaction.response.send_message(embed=embed) await interaction.response.send_message(embed=embed)
@ -105,21 +105,21 @@ class System(commands.Cog):
target = member or interaction.user target = member or interaction.user
embed = discord.Embed( embed = discord.Embed(
title=f'👤 {target.name}', title=f'{target.name}',
color=target.color if target.color != discord.Color.default() else 0x5865F2, color=target.color if target.color != discord.Color.default() else 0x5865F2,
timestamp=datetime.utcnow() timestamp=datetime.utcnow()
) )
embed.set_thumbnail(url=target.display_avatar.url) embed.set_thumbnail(url=target.display_avatar.url)
embed.add_field(name='🆔 ID', value=target.id, inline=True) embed.add_field(name='ID', value=target.id, inline=True)
embed.add_field(name='📛 Nickname', value=target.nick or 'None', inline=True) embed.add_field(name='Nickname', value=target.nick or 'None', inline=True)
embed.add_field(name='🤖 Bot', value='Yes' if target.bot else 'No', inline=True) embed.add_field(name='Bot', value='Yes' if target.bot else 'No', inline=True)
embed.add_field(name='📅 Joined Server', value=target.joined_at.strftime('%Y-%m-%d %H:%M') if target.joined_at else 'Unknown', inline=True) embed.add_field(name='Joined Server', value=target.joined_at.strftime('%Y-%m-%d %H:%M') if target.joined_at else 'Unknown', inline=True)
embed.add_field(name='📅 Account Created', value=target.created_at.strftime('%Y-%m-%d %H:%M'), inline=True) embed.add_field(name='Account Created', value=target.created_at.strftime('%Y-%m-%d %H:%M'), inline=True)
roles = [role.mention for role in target.roles if role.name != '@everyone'] roles = [role.mention for role in target.roles if role.name != '@everyone']
embed.add_field(name=f'🎭 Roles ({len(roles)})', value=' '.join(roles) if roles else 'None', inline=False) embed.add_field(name=f'Roles ({len(roles)})', value=' '.join(roles) if roles else 'None', inline=False)
await interaction.response.send_message(embed=embed) await interaction.response.send_message(embed=embed)
@ -128,18 +128,18 @@ class System(commands.Cog):
@app_commands.default_permissions(kick_members=True) @app_commands.default_permissions(kick_members=True)
async def kick(self, interaction: discord.Interaction, member: discord.Member, reason: str = 'No reason provided'): async def kick(self, interaction: discord.Interaction, member: discord.Member, reason: str = 'No reason provided'):
if member.top_role >= interaction.user.top_role and interaction.user != interaction.guild.owner: if member.top_role >= interaction.user.top_role and interaction.user != interaction.guild.owner:
await interaction.response.send_message('You cannot kick this member!', ephemeral=True) await interaction.response.send_message('You cannot kick this member!', ephemeral=True)
return return
if member == interaction.guild.owner: if member == interaction.guild.owner:
await interaction.response.send_message('You cannot kick the server owner!', ephemeral=True) await interaction.response.send_message('You cannot kick the server owner!', ephemeral=True)
return return
try: try:
await member.kick(reason=f'{reason} | Kicked by {interaction.user}') await member.kick(reason=f'{reason} | Kicked by {interaction.user}')
embed = discord.Embed( embed = discord.Embed(
title='👢 Member Kicked', title='Member Kicked',
description=f'{member.mention} has been kicked from the server', description=f'{member.mention} has been kicked from the server',
color=0xFF9500, color=0xFF9500,
timestamp=datetime.utcnow() timestamp=datetime.utcnow()
@ -148,33 +148,33 @@ class System(commands.Cog):
embed.add_field(name='Reason', value=reason, inline=False) embed.add_field(name='Reason', value=reason, inline=False)
await interaction.response.send_message(embed=embed) await interaction.response.send_message(embed=embed)
logger.info(f'👢 {member} kicked by {interaction.user} - Reason: {reason}') logger.info(f'{member} kicked by {interaction.user} - Reason: {reason}')
except discord.Forbidden: except discord.Forbidden:
await interaction.response.send_message('I do not have permission to kick this member!', ephemeral=True) await interaction.response.send_message('I do not have permission to kick this member!', ephemeral=True)
except Exception as e: except Exception as e:
await interaction.response.send_message(f'An error occurred: {e}', ephemeral=True) await interaction.response.send_message(f'An error occurred: {e}', ephemeral=True)
@app_commands.command(name='ban', description='[MOD] Ban a member from the server') @app_commands.command(name='ban', description='[MOD] Ban a member from the server')
@app_commands.describe(member='Member to ban', reason='Reason for ban', delete_days='Days of messages to delete (0-7)') @app_commands.describe(member='Member to ban', reason='Reason for ban', delete_days='Days of messages to delete (0-7)')
@app_commands.default_permissions(ban_members=True) @app_commands.default_permissions(ban_members=True)
async def ban(self, interaction: discord.Interaction, member: discord.Member, reason: str = 'No reason provided', delete_days: int = 0): async def ban(self, interaction: discord.Interaction, member: discord.Member, reason: str = 'No reason provided', delete_days: int = 0):
if member.top_role >= interaction.user.top_role and interaction.user != interaction.guild.owner: if member.top_role >= interaction.user.top_role and interaction.user != interaction.guild.owner:
await interaction.response.send_message('You cannot ban this member!', ephemeral=True) await interaction.response.send_message('You cannot ban this member!', ephemeral=True)
return return
if member == interaction.guild.owner: if member == interaction.guild.owner:
await interaction.response.send_message('You cannot ban the server owner!', ephemeral=True) await interaction.response.send_message('You cannot ban the server owner!', ephemeral=True)
return return
if delete_days < 0 or delete_days > 7: if delete_days < 0 or delete_days > 7:
await interaction.response.send_message('Delete days must be between 0 and 7!', ephemeral=True) await interaction.response.send_message('Delete days must be between 0 and 7!', ephemeral=True)
return return
try: try:
await member.ban(reason=f'{reason} | Banned by {interaction.user}', delete_message_days=delete_days) await member.ban(reason=f'{reason} | Banned by {interaction.user}', delete_message_days=delete_days)
embed = discord.Embed( embed = discord.Embed(
title='🔨 Member Banned', title='Member Banned',
description=f'{member.mention} has been banned from the server', description=f'{member.mention} has been banned from the server',
color=0xFF0000, color=0xFF0000,
timestamp=datetime.utcnow() timestamp=datetime.utcnow()
@ -183,11 +183,11 @@ class System(commands.Cog):
embed.add_field(name='Reason', value=reason, inline=False) embed.add_field(name='Reason', value=reason, inline=False)
await interaction.response.send_message(embed=embed) await interaction.response.send_message(embed=embed)
logger.info(f'🔨 {member} banned by {interaction.user} - Reason: {reason}') logger.info(f'{member} banned by {interaction.user} - Reason: {reason}')
except discord.Forbidden: except discord.Forbidden:
await interaction.response.send_message('I do not have permission to ban this member!', ephemeral=True) await interaction.response.send_message('I do not have permission to ban this member!', ephemeral=True)
except Exception as e: except Exception as e:
await interaction.response.send_message(f'An error occurred: {e}', ephemeral=True) await interaction.response.send_message(f'An error occurred: {e}', ephemeral=True)
@app_commands.command(name='unban', description='[MOD] Unban a user from the server') @app_commands.command(name='unban', description='[MOD] Unban a user from the server')
@app_commands.describe(user_id='User ID to unban', reason='Reason for unban') @app_commands.describe(user_id='User ID to unban', reason='Reason for unban')
@ -196,14 +196,14 @@ class System(commands.Cog):
try: try:
user = await self.bot.fetch_user(int(user_id)) user = await self.bot.fetch_user(int(user_id))
except: except:
await interaction.response.send_message('Invalid user ID!', ephemeral=True) await interaction.response.send_message('Invalid user ID!', ephemeral=True)
return return
try: try:
await interaction.guild.unban(user, reason=f'{reason} | Unbanned by {interaction.user}') await interaction.guild.unban(user, reason=f'{reason} | Unbanned by {interaction.user}')
embed = discord.Embed( embed = discord.Embed(
title='User Unbanned', title='User Unbanned',
description=f'{user.mention} has been unbanned from the server', description=f'{user.mention} has been unbanned from the server',
color=0x00FF00, color=0x00FF00,
timestamp=datetime.utcnow() timestamp=datetime.utcnow()
@ -212,28 +212,28 @@ class System(commands.Cog):
embed.add_field(name='Reason', value=reason, inline=False) embed.add_field(name='Reason', value=reason, inline=False)
await interaction.response.send_message(embed=embed) await interaction.response.send_message(embed=embed)
logger.info(f'{user} unbanned by {interaction.user} - Reason: {reason}') logger.info(f'{user} unbanned by {interaction.user} - Reason: {reason}')
except discord.NotFound: except discord.NotFound:
await interaction.response.send_message('This user is not banned!', ephemeral=True) await interaction.response.send_message('This user is not banned!', ephemeral=True)
except discord.Forbidden: except discord.Forbidden:
await interaction.response.send_message('I do not have permission to unban users!', ephemeral=True) await interaction.response.send_message('I do not have permission to unban users!', ephemeral=True)
except Exception as e: except Exception as e:
await interaction.response.send_message(f'An error occurred: {e}', ephemeral=True) await interaction.response.send_message(f'An error occurred: {e}', ephemeral=True)
@app_commands.command(name='timeout', description='[MOD] Timeout a member') @app_commands.command(name='timeout', description='[MOD] Timeout a member')
@app_commands.describe(member='Member to timeout', duration='Duration in minutes', reason='Reason for timeout') @app_commands.describe(member='Member to timeout', duration='Duration in minutes', reason='Reason for timeout')
@app_commands.default_permissions(moderate_members=True) @app_commands.default_permissions(moderate_members=True)
async def timeout(self, interaction: discord.Interaction, member: discord.Member, duration: int, reason: str = 'No reason provided'): async def timeout(self, interaction: discord.Interaction, member: discord.Member, duration: int, reason: str = 'No reason provided'):
if member.top_role >= interaction.user.top_role and interaction.user != interaction.guild.owner: if member.top_role >= interaction.user.top_role and interaction.user != interaction.guild.owner:
await interaction.response.send_message('You cannot timeout this member!', ephemeral=True) await interaction.response.send_message('You cannot timeout this member!', ephemeral=True)
return return
if member == interaction.guild.owner: if member == interaction.guild.owner:
await interaction.response.send_message('You cannot timeout the server owner!', ephemeral=True) await interaction.response.send_message('You cannot timeout the server owner!', ephemeral=True)
return return
if duration < 1 or duration > 40320: if duration < 1 or duration > 40320:
await interaction.response.send_message('Duration must be between 1 minute and 28 days!', ephemeral=True) await interaction.response.send_message('Duration must be between 1 minute and 28 days!', ephemeral=True)
return return
try: try:
@ -241,7 +241,7 @@ class System(commands.Cog):
await member.timeout(timeout_until, reason=f'{reason} | Timed out by {interaction.user}') await member.timeout(timeout_until, reason=f'{reason} | Timed out by {interaction.user}')
embed = discord.Embed( embed = discord.Embed(
title='Member Timed Out', title='Member Timed Out',
description=f'{member.mention} has been timed out', description=f'{member.mention} has been timed out',
color=0xFFA500, color=0xFFA500,
timestamp=datetime.utcnow() timestamp=datetime.utcnow()
@ -251,11 +251,11 @@ class System(commands.Cog):
embed.add_field(name='Reason', value=reason, inline=False) embed.add_field(name='Reason', value=reason, inline=False)
await interaction.response.send_message(embed=embed) await interaction.response.send_message(embed=embed)
logger.info(f'{member} timed out by {interaction.user} for {duration}m - Reason: {reason}') logger.info(f'{member} timed out by {interaction.user} for {duration}m - Reason: {reason}')
except discord.Forbidden: except discord.Forbidden:
await interaction.response.send_message('I do not have permission to timeout this member!', ephemeral=True) await interaction.response.send_message('I do not have permission to timeout this member!', ephemeral=True)
except Exception as e: except Exception as e:
await interaction.response.send_message(f'An error occurred: {e}', ephemeral=True) await interaction.response.send_message(f'An error occurred: {e}', ephemeral=True)
@app_commands.command(name='warn', description='[MOD] Warn a member') @app_commands.command(name='warn', description='[MOD] Warn a member')
@app_commands.describe(member='Member to warn', reason='Reason for warning') @app_commands.describe(member='Member to warn', reason='Reason for warning')
@ -285,7 +285,7 @@ class System(commands.Cog):
warning_count = len(self.bot.db.data['warnings'][guild_id][user_id]) warning_count = len(self.bot.db.data['warnings'][guild_id][user_id])
embed = discord.Embed( embed = discord.Embed(
title='⚠️ Member Warned', title='Member Warned',
description=f'{member.mention} has been warned', description=f'{member.mention} has been warned',
color=0xFFFF00, color=0xFFFF00,
timestamp=datetime.utcnow() timestamp=datetime.utcnow()
@ -297,11 +297,11 @@ class System(commands.Cog):
await interaction.response.send_message(embed=embed) await interaction.response.send_message(embed=embed)
try: try:
await member.send(f'⚠️ You have been warned in **{interaction.guild.name}**\n**Reason:** {reason}\n**Total Warnings:** {warning_count}') await member.send(f'You have been warned in **{interaction.guild.name}**\n**Reason:** {reason}\n**Total Warnings:** {warning_count}')
except: except:
pass pass
logger.info(f'⚠️ {member} warned by {interaction.user} - Reason: {reason}') logger.info(f'{member} warned by {interaction.user} - Reason: {reason}')
@app_commands.command(name='warnings', description='View warnings for a member') @app_commands.command(name='warnings', description='View warnings for a member')
@app_commands.describe(member='Member to check warnings for') @app_commands.describe(member='Member to check warnings for')
@ -320,7 +320,7 @@ class System(commands.Cog):
return return
embed = discord.Embed( embed = discord.Embed(
title=f'⚠️ Warnings for {target.display_name}', title=f'Warnings for {target.display_name}',
color=0xFFFF00, color=0xFFFF00,
timestamp=datetime.utcnow() timestamp=datetime.utcnow()
) )
@ -359,7 +359,7 @@ class System(commands.Cog):
self.bot.db.save() self.bot.db.save()
embed = discord.Embed( embed = discord.Embed(
title='Warnings Cleared', title='Warnings Cleared',
description=f'Cleared {warning_count} warning(s) for {member.mention}', description=f'Cleared {warning_count} warning(s) for {member.mention}',
color=0x00FF00, color=0x00FF00,
timestamp=datetime.utcnow() timestamp=datetime.utcnow()
@ -367,14 +367,14 @@ class System(commands.Cog):
embed.add_field(name='Moderator', value=interaction.user.mention, inline=True) embed.add_field(name='Moderator', value=interaction.user.mention, inline=True)
await interaction.response.send_message(embed=embed) await interaction.response.send_message(embed=embed)
logger.info(f'Cleared {warning_count} warnings for {member} by {interaction.user}') logger.info(f'Cleared {warning_count} warnings for {member} by {interaction.user}')
@app_commands.command(name='purge', description='[MOD] Delete multiple messages') @app_commands.command(name='purge', description='[MOD] Delete multiple messages')
@app_commands.describe(amount='Number of messages to delete (1-100)', member='Only delete messages from this member (optional)') @app_commands.describe(amount='Number of messages to delete (1-100)', member='Only delete messages from this member (optional)')
@app_commands.default_permissions(manage_messages=True) @app_commands.default_permissions(manage_messages=True)
async def purge(self, interaction: discord.Interaction, amount: int, member: discord.Member = None): async def purge(self, interaction: discord.Interaction, amount: int, member: discord.Member = None):
if amount < 1 or amount > 100: if amount < 1 or amount > 100:
await interaction.response.send_message('Amount must be between 1 and 100!', ephemeral=True) await interaction.response.send_message('Amount must be between 1 and 100!', ephemeral=True)
return return
await interaction.response.defer(ephemeral=True) await interaction.response.defer(ephemeral=True)
@ -385,12 +385,12 @@ class System(commands.Cog):
else: else:
deleted = await interaction.channel.purge(limit=amount) deleted = await interaction.channel.purge(limit=amount)
await interaction.followup.send(f'Deleted {len(deleted)} message(s)!', ephemeral=True) await interaction.followup.send(f'Deleted {len(deleted)} message(s)!', ephemeral=True)
logger.info(f'🗑️ {interaction.user} purged {len(deleted)} messages in #{interaction.channel.name}') logger.info(f'{interaction.user} purged {len(deleted)} messages in #{interaction.channel.name}')
except discord.Forbidden: except discord.Forbidden:
await interaction.followup.send('I do not have permission to delete messages!', ephemeral=True) await interaction.followup.send('I do not have permission to delete messages!', ephemeral=True)
except Exception as e: except Exception as e:
await interaction.followup.send(f'An error occurred: {e}', ephemeral=True) await interaction.followup.send(f'An error occurred: {e}', ephemeral=True)
@app_commands.command(name='lock', description='[MOD] Lock a channel') @app_commands.command(name='lock', description='[MOD] Lock a channel')
@app_commands.describe(channel='Channel to lock (defaults to current channel)') @app_commands.describe(channel='Channel to lock (defaults to current channel)')
@ -402,7 +402,7 @@ class System(commands.Cog):
await target_channel.set_permissions(interaction.guild.default_role, send_messages=False) await target_channel.set_permissions(interaction.guild.default_role, send_messages=False)
embed = discord.Embed( embed = discord.Embed(
title='🔒 Channel Locked', title='Channel Locked',
description=f'{target_channel.mention} has been locked', description=f'{target_channel.mention} has been locked',
color=0xFF0000, color=0xFF0000,
timestamp=datetime.utcnow() timestamp=datetime.utcnow()
@ -410,11 +410,11 @@ class System(commands.Cog):
embed.add_field(name='Moderator', value=interaction.user.mention, inline=True) embed.add_field(name='Moderator', value=interaction.user.mention, inline=True)
await interaction.response.send_message(embed=embed) await interaction.response.send_message(embed=embed)
logger.info(f'🔒 {target_channel.name} locked by {interaction.user}') logger.info(f'{target_channel.name} locked by {interaction.user}')
except discord.Forbidden: except discord.Forbidden:
await interaction.response.send_message('I do not have permission to lock this channel!', ephemeral=True) await interaction.response.send_message('I do not have permission to lock this channel!', ephemeral=True)
except Exception as e: except Exception as e:
await interaction.response.send_message(f'An error occurred: {e}', ephemeral=True) await interaction.response.send_message(f'An error occurred: {e}', ephemeral=True)
@app_commands.command(name='unlock', description='[MOD] Unlock a channel') @app_commands.command(name='unlock', description='[MOD] Unlock a channel')
@app_commands.describe(channel='Channel to unlock (defaults to current channel)') @app_commands.describe(channel='Channel to unlock (defaults to current channel)')
@ -426,7 +426,7 @@ class System(commands.Cog):
await target_channel.set_permissions(interaction.guild.default_role, send_messages=None) await target_channel.set_permissions(interaction.guild.default_role, send_messages=None)
embed = discord.Embed( embed = discord.Embed(
title='🔓 Channel Unlocked', title='Channel Unlocked',
description=f'{target_channel.mention} has been unlocked', description=f'{target_channel.mention} has been unlocked',
color=0x00FF00, color=0x00FF00,
timestamp=datetime.utcnow() timestamp=datetime.utcnow()
@ -434,11 +434,11 @@ class System(commands.Cog):
embed.add_field(name='Moderator', value=interaction.user.mention, inline=True) embed.add_field(name='Moderator', value=interaction.user.mention, inline=True)
await interaction.response.send_message(embed=embed) await interaction.response.send_message(embed=embed)
logger.info(f'🔓 {target_channel.name} unlocked by {interaction.user}') logger.info(f'{target_channel.name} unlocked by {interaction.user}')
except discord.Forbidden: except discord.Forbidden:
await interaction.response.send_message('I do not have permission to unlock this channel!', ephemeral=True) await interaction.response.send_message('I do not have permission to unlock this channel!', ephemeral=True)
except Exception as e: except Exception as e:
await interaction.response.send_message(f'An error occurred: {e}', ephemeral=True) await interaction.response.send_message(f'An error occurred: {e}', ephemeral=True)
@commands.Cog.listener() @commands.Cog.listener()
async def on_raw_reaction_add(self, payload): async def on_raw_reaction_add(self, payload):
@ -477,9 +477,9 @@ class System(commands.Cog):
try: try:
await member.add_roles(role) await member.add_roles(role)
logger.info(f'Added role {role.name} to {member.name}') logger.info(f'Added role {role.name} to {member.name}')
except Exception as e: except Exception as e:
logger.error(f'Error adding role: {e}') logger.error(f'Error adding role: {e}')
@commands.Cog.listener() @commands.Cog.listener()
async def on_raw_reaction_remove(self, payload): async def on_raw_reaction_remove(self, payload):
@ -518,9 +518,9 @@ class System(commands.Cog):
try: try:
await member.remove_roles(role) await member.remove_roles(role)
logger.info(f' Removed role {role.name} from {member.name}') logger.info(f'Removed role {role.name} from {member.name}')
except Exception as e: except Exception as e:
logger.error(f'Error removing role: {e}') logger.error(f'Error removing role: {e}')
@app_commands.command(name='reactionrole', description='[ADMIN] Create a reaction role') @app_commands.command(name='reactionrole', description='[ADMIN] Create a reaction role')
@app_commands.describe(message_id='Message ID to add reactions to', emoji='Emoji to use (e.g., 🎮)', role='Role to assign') @app_commands.describe(message_id='Message ID to add reactions to', emoji='Emoji to use (e.g., 🎮)', role='Role to assign')
@ -529,16 +529,16 @@ class System(commands.Cog):
try: try:
message = await interaction.channel.fetch_message(int(message_id)) message = await interaction.channel.fetch_message(int(message_id))
except discord.NotFound: except discord.NotFound:
await interaction.response.send_message('Message not found in this channel!', ephemeral=True) await interaction.response.send_message('Message not found in this channel!', ephemeral=True)
return return
except ValueError: except ValueError:
await interaction.response.send_message('Invalid message ID!', ephemeral=True) await interaction.response.send_message('Invalid message ID!', ephemeral=True)
return return
try: try:
await message.add_reaction(emoji) await message.add_reaction(emoji)
except discord.HTTPException: except discord.HTTPException:
await interaction.response.send_message('Invalid emoji or unable to add reaction!', ephemeral=True) await interaction.response.send_message('Invalid emoji or unable to add reaction!', ephemeral=True)
return return
guild_id = str(interaction.guild.id) guild_id = str(interaction.guild.id)
@ -556,7 +556,7 @@ class System(commands.Cog):
self.bot.db.save() self.bot.db.save()
embed = discord.Embed( embed = discord.Embed(
title='Reaction Role Created', title='Reaction Role Created',
description=f'React with {emoji} on the message to get {role.mention}', description=f'React with {emoji} on the message to get {role.mention}',
color=0x00FF00 color=0x00FF00
) )
@ -565,7 +565,7 @@ class System(commands.Cog):
embed.add_field(name='Role', value=role.mention, inline=True) embed.add_field(name='Role', value=role.mention, inline=True)
await interaction.response.send_message(embed=embed) await interaction.response.send_message(embed=embed)
logger.info(f'Created reaction role: {emoji} -> {role.name}') logger.info(f'Created reaction role: {emoji} -> {role.name}')
@app_commands.command(name='removereactionrole', description='[ADMIN] Remove a reaction role') @app_commands.command(name='removereactionrole', description='[ADMIN] Remove a reaction role')
@app_commands.describe(message_id='Message ID', emoji='Emoji to remove (leave empty to remove all)') @app_commands.describe(message_id='Message ID', emoji='Emoji to remove (leave empty to remove all)')
@ -577,21 +577,21 @@ class System(commands.Cog):
self.bot.db.data['reaction_roles'] = {} self.bot.db.data['reaction_roles'] = {}
if guild_id not in self.bot.db.data['reaction_roles'] or message_id not in self.bot.db.data['reaction_roles'].get(guild_id, {}): if guild_id not in self.bot.db.data['reaction_roles'] or message_id not in self.bot.db.data['reaction_roles'].get(guild_id, {}):
await interaction.response.send_message('No reaction roles found for that message!', ephemeral=True) await interaction.response.send_message('No reaction roles found for that message!', ephemeral=True)
return return
if emoji: if emoji:
if emoji not in self.bot.db.data['reaction_roles'][guild_id][message_id]: if emoji not in self.bot.db.data['reaction_roles'][guild_id][message_id]:
await interaction.response.send_message('That emoji is not set up for reaction roles!', ephemeral=True) await interaction.response.send_message('That emoji is not set up for reaction roles!', ephemeral=True)
return return
del self.bot.db.data['reaction_roles'][guild_id][message_id][emoji] del self.bot.db.data['reaction_roles'][guild_id][message_id][emoji]
self.bot.db.save() self.bot.db.save()
await interaction.response.send_message(f'Removed reaction role for {emoji}') await interaction.response.send_message(f'Removed reaction role for {emoji}')
else: else:
del self.bot.db.data['reaction_roles'][guild_id][message_id] del self.bot.db.data['reaction_roles'][guild_id][message_id]
self.bot.db.save() self.bot.db.save()
await interaction.response.send_message(f'Removed all reaction roles from message {message_id}') await interaction.response.send_message(f'Removed all reaction roles from message {message_id}')
@app_commands.command(name='listreactionroles', description='List all reaction roles') @app_commands.command(name='listreactionroles', description='List all reaction roles')
async def listreactionroles(self, interaction: discord.Interaction): async def listreactionroles(self, interaction: discord.Interaction):
@ -607,7 +607,7 @@ class System(commands.Cog):
return return
embed = discord.Embed( embed = discord.Embed(
title='🎭 Reaction Roles', title='Reaction Roles',
color=0x9B59B6 color=0x9B59B6
) )
@ -631,7 +631,7 @@ class System(commands.Cog):
@app_commands.default_permissions(administrator=True) @app_commands.default_permissions(administrator=True)
async def createreactionpanel(self, interaction: discord.Interaction, title: str, description: str): async def createreactionpanel(self, interaction: discord.Interaction, title: str, description: str):
embed = discord.Embed( embed = discord.Embed(
title=f'🎭 {title}', title=f'{title}',
description=description, description=description,
color=0x9B59B6 color=0x9B59B6
) )
@ -640,7 +640,7 @@ class System(commands.Cog):
message = await interaction.channel.send(embed=embed) message = await interaction.channel.send(embed=embed)
await interaction.response.send_message( await interaction.response.send_message(
f'Panel created! Message ID: `{message.id}`\n' f'Panel created! Message ID: `{message.id}`\n'
f'Use `/reactionrole {message.id} <emoji> <role>` to add roles to it.', f'Use `/reactionrole {message.id} <emoji> <role>` to add roles to it.',
ephemeral=True ephemeral=True
) )
@ -664,16 +664,16 @@ class System(commands.Cog):
self.bot.db.save() self.bot.db.save()
embed = discord.Embed( embed = discord.Embed(
title='YouTube Notifications Configured', title='YouTube Notifications Configured',
description=f'New video notifications will be posted in {channel.mention}', description=f'New video notifications will be posted in {channel.mention}',
color=0xFF0000 color=0xFF0000
) )
embed.add_field(name='YouTube Channel ID', value=f'`{youtube_channel_id}`', inline=False) embed.add_field(name='YouTube Channel ID', value=f'`{youtube_channel_id}`', inline=False)
embed.add_field(name='Check Interval', value='Every 5 minutes', inline=True) embed.add_field(name='Check Interval', value='Every 5 minutes', inline=True)
embed.add_field(name='Status', value='🟢 Active', inline=True) embed.add_field(name='Status', value='Active', inline=True)
await interaction.response.send_message(embed=embed) await interaction.response.send_message(embed=embed)
logger.info(f'YouTube notifications enabled in {interaction.guild.name} → #{channel.name}') logger.info(f'YouTube notifications enabled in {interaction.guild.name} → #{channel.name}')
@app_commands.command(name='toggleyoutube', description='[ADMIN] Toggle YouTube notifications on/off') @app_commands.command(name='toggleyoutube', description='[ADMIN] Toggle YouTube notifications on/off')
@app_commands.default_permissions(administrator=True) @app_commands.default_permissions(administrator=True)
@ -693,11 +693,11 @@ class System(commands.Cog):
self.bot.db.data['youtube'][guild_id]['enabled'] = not self.bot.db.data['youtube'][guild_id].get('enabled', False) self.bot.db.data['youtube'][guild_id]['enabled'] = not self.bot.db.data['youtube'][guild_id].get('enabled', False)
self.bot.db.save() self.bot.db.save()
status = 'enabled' if self.bot.db.data['youtube'][guild_id]['enabled'] else 'disabled' status = 'enabled' if self.bot.db.data['youtube'][guild_id]['enabled'] else 'disabled'
color = 0x00FF00 if self.bot.db.data['youtube'][guild_id]['enabled'] else 0x808080 color = 0x00FF00 if self.bot.db.data['youtube'][guild_id]['enabled'] else 0x808080
embed = discord.Embed( embed = discord.Embed(
title='🔔 YouTube Notifications', title='YouTube Notifications',
description=f'YouTube notifications are now **{status}**', description=f'YouTube notifications are now **{status}**',
color=color, color=color,
timestamp=datetime.utcnow() timestamp=datetime.utcnow()
@ -719,11 +719,11 @@ class System(commands.Cog):
}) })
embed = discord.Embed( embed = discord.Embed(
title='📺 YouTube Notification Status', title='YouTube Notification Status',
color=0xFF0000 color=0xFF0000
) )
status = '🟢 Enabled' if settings.get('enabled') else '🔴 Disabled' status = 'Enabled' if settings.get('enabled') else 'Disabled'
embed.add_field(name='Status', value=status, inline=True) embed.add_field(name='Status', value=status, inline=True)
if settings.get('channel_id'): if settings.get('channel_id'):
@ -736,7 +736,7 @@ class System(commands.Cog):
if settings.get('youtube_channel_id'): if settings.get('youtube_channel_id'):
embed.add_field(name='YouTube Channel ID', value=f'`{settings["youtube_channel_id"]}`', inline=False) embed.add_field(name='YouTube Channel ID', value=f'`{settings["youtube_channel_id"]}`', inline=False)
else: else:
embed.add_field(name='⚠️ Warning', value='YouTube Channel ID not set', inline=False) embed.add_field(name='Warning', value='YouTube Channel ID not set', inline=False)
if settings.get('last_video_id'): if settings.get('last_video_id'):
embed.add_field(name='Last Video ID', value=f'`{settings["last_video_id"]}`', inline=False) embed.add_field(name='Last Video ID', value=f'`{settings["last_video_id"]}`', inline=False)
@ -756,7 +756,7 @@ class System(commands.Cog):
settings = self.bot.db.data['youtube'].get(guild_id, {}) settings = self.bot.db.data['youtube'].get(guild_id, {})
if not settings.get('youtube_channel_id'): if not settings.get('youtube_channel_id'):
await interaction.response.send_message('YouTube Channel ID not configured! Use `/setupyoutube` first.', ephemeral=True) await interaction.response.send_message('YouTube Channel ID not configured! Use `/setupyoutube` first.', ephemeral=True)
return return
await interaction.response.defer() await interaction.response.defer()
@ -766,14 +766,14 @@ class System(commands.Cog):
feed = await asyncio.to_thread(feedparser.parse, feed_url) feed = await asyncio.to_thread(feedparser.parse, feed_url)
if not feed.entries: if not feed.entries:
await interaction.followup.send('No videos found for this channel!') await interaction.followup.send('No videos found for this channel!')
return return
latest = feed.entries[0] latest = feed.entries[0]
video_id = latest.yt_videoid if hasattr(latest, 'yt_videoid') else latest.id.split(':')[-1] video_id = latest.yt_videoid if hasattr(latest, 'yt_videoid') else latest.id.split(':')[-1]
embed = discord.Embed( embed = discord.Embed(
title='🎬 Latest YouTube Video (Test)', title='Latest YouTube Video (Test)',
description=f'**{latest.title}**', description=f'**{latest.title}**',
url=latest.link, url=latest.link,
color=0xFF0000, color=0xFF0000,
@ -791,11 +791,11 @@ class System(commands.Cog):
embed.set_footer(text='This is a test notification') embed.set_footer(text='This is a test notification')
await interaction.followup.send(embed=embed) await interaction.followup.send(embed=embed)
logger.info(f'📺 Test notification sent for: {latest.title}') logger.info(f'Test notification sent for: {latest.title}')
except Exception as e: except Exception as e:
await interaction.followup.send(f'Error fetching video: {e}') await interaction.followup.send(f'Error fetching video: {e}')
logger.error(f'Error in testlastvideo: {e}') logger.error(f'Error in testlastvideo: {e}')
async def setup(bot): async def setup(bot):
await bot.add_cog(System(bot)) await bot.add_cog(System(bot))