FunkyBot/cogs/languages.py

112 lines
4.4 KiB
Python
Raw Normal View History

2025-06-16 08:06:06 +00:00
import discord
from discord import app_commands
from discord.ext import commands
from libs.Cog import Cog
from libs.Role import Role
class Languages(Cog):
def __init__(self, bot):
super().__init__(bot)
self.messages_deletable = True
self.role = Role()
@app_commands.command(
name="php",
description="adds the PHP role"
)
async def php(self, interaction: discord.Interaction):
await self.role.add_role(interaction, "PHP")
await interaction.response.send_message("You are now associated with the PHP language group", ephemeral=True)
@app_commands.command(
name="nophp",
description="removes the PHP role if you have it"
)
async def nophp(self, interaction: discord.Interaction):
await self.role.remove_role(interaction, "PHP")
await interaction.response.send_message("You are no longer associated with the PHP language group", ephemeral=True)
@app_commands.command(
name="python",
description="adds the Python role"
)
async def python(self, interaction: discord.Interaction):
await self.role.add_role(interaction, "Python")
await interaction.response.send_message("You are now associated with the Python language group", ephemeral=True)
@app_commands.command(
name="nopython",
description="removes the Python role if you have it"
)
async def nophp(self, interaction: discord.Interaction):
await self.role.remove_role(interaction, "Python")
await interaction.response.send_message("You are no longer associated with the Python language group", ephemeral=True)
@app_commands.command(
name="js",
description="adds the JavaScript role"
)
async def js(self, interaction: discord.Interaction):
await self.role.add_role(interaction, "JavaScript")
await interaction.response.send_message("You are now associated with the JavaScript language group", ephemeral=True)
@app_commands.command(
name="nojs",
description="removes the JavaScript role if you have it"
)
async def nojs(self, interaction: discord.Interaction):
await self.role.remove_role(interaction, "JavaScript")
await interaction.response.send_message("You are no longer associated with the JavaScript language group", ephemeral=True)
@app_commands.command(
name="ruby",
description="adds the Ruby role"
)
async def ruby(self, interaction: discord.Interaction):
await self.role.add_role(interaction, "Ruby")
await interaction.response.send_message("You are now associated with the Ruby language group", ephemeral=True)
@app_commands.command(
name="noruby",
description="removes the Ruby role if you have it"
)
async def noruby(self, interaction: discord.Interaction):
await self.role.remove_role(interaction, "Ruby")
await interaction.response.send_message("You are no longer associated with the Ruby language group", ephemeral=True)
@app_commands.command(
name="cs",
description="adds the C# role"
)
async def cs(self, interaction: discord.Interaction):
await self.role.add_role(interaction, "C#")
await interaction.response.send_message("You are now associated with the C# language group", ephemeral=True)
@app_commands.command(
name="nocs",
description="removes the C# role if you have it"
)
async def nocs(self, interaction: discord.Interaction):
await self.role.remove_role(interaction, "C#")
await interaction.response.send_message("You are no longer associated with the C# language group", ephemeral=True)
@app_commands.command(
name="java",
description="adds the Java role"
)
async def java(self, interaction: discord.Interaction):
await self.role.add_role(interaction, "Java")
await interaction.response.send_message("You are now associated with the Java language group", ephemeral=True)
@app_commands.command(
name="nojava",
description="removes the Java role if you have it"
)
async def nojava(self, interaction: discord.Interaction):
await self.role.remove_role(interaction, "Java")
await interaction.response.send_message("You are no longer associated with the Java language group", ephemeral=True)
async def setup(bot):
await bot.add_cog(Languages(bot), guilds=[discord.Object(id=bot.guild_id)])