feat: (check description). 8ball, botinfo, context menu, feedback

Moved eightball cog from general to fun category and updated help command mapping accordingly. Added support for disabling cogs via the DISABLED_COGS environment variable in bot.py. Updated embed styles and author fields for botinfo, feedback, and eightball commands. Commented out context_menus cog code.
This commit is contained in:
neoarz
2025-09-15 08:44:54 -04:00
parent 93dcd03985
commit 5d893a8a84
7 changed files with 87 additions and 108 deletions

View File

@@ -1,11 +1,3 @@
"""
Copyright © Krypton 2019-Present - https://github.com/kkrypt0nn (https://krypton.ninja)
Description:
🐍 A simple template to start to code your own and personalized Discord bot in Python
Version: 6.4.0
"""
import platform
import discord
from discord.ext import commands
@@ -27,11 +19,11 @@ class BotInfo(commands.Cog, name="botinfo"):
:param context: The hybrid command context.
"""
embed = discord.Embed(
description="Used [Krypton's](https://krypton.ninja) template",
color=0xBEBEFE,
title="Nyrix Discord Bot",
color=0x7289DA,
)
embed.set_author(name="Bot Information")
embed.add_field(name="Owner:", value="Krypton#7331", inline=True)
embed.set_author(name="Bot Information", icon_url="https://yes.nighty.works/raw/y5SEZ9.webp")
embed.add_field(name="Owner:", value="[neoarz](https://discordapp.com/users/1015372540937502851)", inline=True)
embed.add_field(
name="Python Version:", value=f"{platform.python_version()}", inline=True
)
@@ -40,9 +32,7 @@ class BotInfo(commands.Cog, name="botinfo"):
value=f"/ (Slash Commands) or {self.bot.bot_prefix} for normal commands",
inline=False,
)
embed.set_footer(text=f"Requested by {context.author}")
await context.send(embed=embed)
async def setup(bot) -> None:
await bot.add_cog(BotInfo(bot))
await bot.add_cog(BotInfo(bot))

View File

@@ -1,66 +1,58 @@
"""
Copyright © Krypton 2019-Present - https://github.com/kkrypt0nn (https://krypton.ninja)
Description:
🐍 A simple template to start to code your own and personalized Discord bot in Python
Version: 6.4.0
"""
import discord
from discord import app_commands
from discord.ext import commands
class ContextMenus(commands.Cog, name="context_menus"):
def __init__(self, bot) -> None:
self.bot = bot
self.context_menu_user = app_commands.ContextMenu(
name="Grab ID", callback=self.grab_id
)
self.bot.tree.add_command(self.context_menu_user)
self.context_menu_message = app_commands.ContextMenu(
name="Remove spoilers", callback=self.remove_spoilers
)
self.bot.tree.add_command(self.context_menu_message)
async def remove_spoilers(
self, interaction: discord.Interaction, message: discord.Message
) -> None:
"""
Removes the spoilers from the message. This command requires the MESSAGE_CONTENT intent to work properly.
:param interaction: The application command interaction.
:param message: The message that is being interacted with.
"""
spoiler_attachment = None
for attachment in message.attachments:
if attachment.is_spoiler():
spoiler_attachment = attachment
break
embed = discord.Embed(
title="Message without spoilers",
description=message.content.replace("||", ""),
color=0xBEBEFE,
)
if spoiler_attachment is not None:
embed.set_image(url=attachment.url)
await interaction.response.send_message(embed=embed, ephemeral=True)
async def grab_id(
self, interaction: discord.Interaction, user: discord.User
) -> None:
"""
Grabs the ID of the user.
:param interaction: The application command interaction.
:param user: The user that is being interacted with.
"""
embed = discord.Embed(
description=f"The ID of {user.mention} is `{user.id}`.",
color=0xBEBEFE,
)
await interaction.response.send_message(embed=embed, ephemeral=True)
async def setup(bot) -> None:
await bot.add_cog(ContextMenus(bot))
# import discord
# from discord import app_commands
# from discord.ext import commands
#
#
# class ContextMenus(commands.Cog, name="context_menus"):
# def __init__(self, bot) -> None:
# self.bot = bot
# self.context_menu_user = app_commands.ContextMenu(
# name="Grab ID", callback=self.grab_id
# )
# self.bot.tree.add_command(self.context_menu_user)
# self.context_menu_message = app_commands.ContextMenu(
# name="Remove spoilers", callback=self.remove_spoilers
# )
# self.bot.tree.add_command(self.context_menu_message)
#
# async def remove_spoilers(
# self, interaction: discord.Interaction, message: discord.Message
# ) -> None:
# """
# Removes the spoilers from the message. This command requires the MESSAGE_CONTENT intent to work properly.
#
# :param interaction: The application command interaction.
# :param message: The message that is being interacted with.
# """
# spoiler_attachment = None
# for attachment in message.attachments:
# if attachment.is_spoiler():
# spoiler_attachment = attachment
# break
# embed = discord.Embed(
# title="Message without spoilers",
# description=message.content.replace("||", ""),
# color=0xBEBEFE,
# )
# if spoiler_attachment is not None:
# embed.set_image(url=attachment.url)
# await interaction.response.send_message(embed=embed, ephemeral=True)
#
# async def grab_id(
# self, interaction: discord.Interaction, user: discord.User
# ) -> None:
# """
# Grabs the ID of the user.
#
# :param interaction: The application command interaction.
# :param user: The user that is being interacted with.
# """
# embed = discord.Embed(
# description=f"The ID of {user.mention} is `{user.id}`.",
# color=0xBEBEFE,
# )
# await interaction.response.send_message(embed=embed, ephemeral=True)
#
#
# async def setup(bot) -> None:
# await bot.add_cog(ContextMenus(bot))

View File

@@ -1,64 +0,0 @@
"""
Copyright © Krypton 2019-Present - https://github.com/kkrypt0nn (https://krypton.ninja)
Description:
🐍 A simple template to start to code your own and personalized Discord bot in Python
Version: 6.4.0
"""
import random
import discord
from discord import app_commands
from discord.ext import commands
from discord.ext.commands import Context
class EightBall(commands.Cog, name="8ball"):
def __init__(self, bot) -> None:
self.bot = bot
@commands.hybrid_command(
name="8ball",
description="Ask any question to the bot.",
)
@app_commands.describe(question="The question you want to ask.")
async def eight_ball(self, context: Context, *, question: str) -> None:
"""
Ask any question to the bot.
:param context: The hybrid command context.
:param question: The question that should be asked by the user.
"""
answers = [
"It is certain.",
"It is decidedly so.",
"You may rely on it.",
"Without a doubt.",
"Yes - definitely.",
"As I see, yes.",
"Most likely.",
"Outlook good.",
"Yes.",
"Signs point to yes.",
"Reply hazy, try again.",
"Ask again later.",
"Better not tell you now.",
"Cannot predict now.",
"Concentrate and ask again later.",
"Don't count on it.",
"My reply is no.",
"My sources say no.",
"Outlook not so good.",
"Very doubtful.",
]
embed = discord.Embed(
title="**My Answer:**",
description=f"{random.choice(answers)}",
color=0xBEBEFE,
)
embed.set_footer(text=f"The question was: {question}")
await context.send(embed=embed)
async def setup(bot) -> None:
await bot.add_cog(EightBall(bot))

View File

@@ -1,11 +1,3 @@
"""
Copyright © Krypton 2019-Present - https://github.com/kkrypt0nn (https://krypton.ninja)
Description:
🐍 A simple template to start to code your own and personalized Discord bot in Python
Version: 6.4.0
"""
import discord
from discord import app_commands
from discord.ext import commands
@@ -46,9 +38,10 @@ class Feedback(commands.Cog, name="feedback"):
interaction = feedback_form.interaction
await interaction.response.send_message(
embed=discord.Embed(
description="Thank you for your feedback, the owners have been notified about it.",
color=0xBEBEFE,
)
title="Thank You!",
description="Your feedback has been submitted, the owners have been notified about it.",
color=0x7289DA,
).set_author(name="Feedback System", icon_url="https://yes.nighty.works/raw/y5SEZ9.webp")
)
app_owner = (await self.bot.application_info()).owner
@@ -56,10 +49,10 @@ class Feedback(commands.Cog, name="feedback"):
embed=discord.Embed(
title="New Feedback",
description=f"{interaction.user} (<@{interaction.user.id}>) has submitted a new feedback:\n```\n{feedback_form.answer}\n```",
color=0xBEBEFE,
)
color=0x7289DA,
).set_author(name="Feedback System", icon_url="https://yes.nighty.works/raw/y5SEZ9.webp")
)
async def setup(bot) -> None:
await bot.add_cog(Feedback(bot))
await bot.add_cog(Feedback(bot))

View File

@@ -44,13 +44,13 @@ class Help(commands.Cog, name="help"):
"ping": "general",
"invite": "general",
"server": "general",
"8ball": "general",
"feedback": "general",
"context_menus": "general",
# "context_menus": "general",
"randomfact": "fun",
"coinflip": "fun",
"rps": "fun",
"8ball": "fun",
"kick": "moderation",
"ban": "moderation",