Changing to pycord

This commit is contained in:
Rafael Vargas
2022-07-27 01:36:55 -03:00
parent 4a22b43ce9
commit fededdbb8c
27 changed files with 217 additions and 118 deletions

View File

@@ -1,22 +1,24 @@
from discord import Client, Game, Status, Embed
from discord.ext.commands.errors import CommandNotFound, MissingRequiredArgument
from discord import Embed
from discord.ext import commands
from discord.ext.commands import Cog
from Config.Configs import Configs
from Config.Helper import Helper
from Config.Messages import Messages
from Config.Colors import Colors
from Music.MusicBot import VulkanBot
from Views.Embeds import Embeds
helper = Helper()
class ControlCog(commands.Cog):
class ControlCog(Cog):
"""Class to handle discord events"""
def __init__(self, bot: Client):
def __init__(self, bot: VulkanBot):
print('Eae3')
self.__bot = bot
print(self.__bot)
print(bot.extensions)
self.__config = Configs()
self.__messages = Messages()
self.__colors = Colors()
self.__embeds = Embeds()
self.__commands = {
@@ -28,27 +30,6 @@ class ControlCog(commands.Cog):
}
@commands.Cog.listener()
async def on_ready(self):
print(self.__messages.STARTUP_MESSAGE)
await self.__bot.change_presence(status=Status.online, activity=Game(name=f"Vulkan | {self.__config.BOT_PREFIX}help"))
print(self.__messages.STARTUP_COMPLETE_MESSAGE)
@commands.Cog.listener()
async def on_command_error(self, ctx, error):
if isinstance(error, MissingRequiredArgument):
embed = self.__embeds.MISSING_ARGUMENTS()
await ctx.send(embed=embed)
elif isinstance(error, CommandNotFound):
embed = self.__embeds.COMMAND_NOT_FOUND()
await ctx.send(embed=embed)
else:
print(f'DEVELOPER NOTE -> Command Error: {error}')
embed = self.__embeds.UNKNOWN_ERROR()
await ctx.send(embed=embed)
@commands.command(name="help", help=helper.HELP_HELP, description=helper.HELP_HELP_LONG, aliases=['h', 'ajuda'])
async def help_msg(self, ctx, command_help=''):
if command_help != '':
@@ -97,7 +78,7 @@ class ControlCog(commands.Cog):
colour=self.__colors.BLUE
)
embedhelp.set_thumbnail(url=self.__bot.user.avatar_url)
embedhelp.set_thumbnail(url=self.__bot.user.avatar)
await ctx.send(embed=embedhelp)
@commands.command(name='invite', help=helper.HELP_INVITE, description=helper.HELP_INVITE_LONG, aliases=['convite', 'inv', 'convidar'])

View File

@@ -232,4 +232,6 @@ class MusicCog(commands.Cog):
def setup(bot):
print('Loading Music')
bot.add_cog(MusicCog(bot))
print('Voltou')

View File

@@ -1,5 +1,5 @@
from random import randint, random
from discord import Client
from Music.MusicBot import VulkanBot
from discord.ext.commands import Context, command, Cog
from Config.Helper import Helper
from Views.Embeds import Embeds
@@ -10,7 +10,10 @@ helper = Helper()
class RandomCog(Cog):
"""Class to listen to commands of type Random"""
def __init__(self, bot: Client):
def __init__(self, bot: VulkanBot):
print('Eae2')
print(bot)
print(bot.extensions)
self.__embeds = Embeds()
@command(name='random', help=helper.HELP_RANDOM, description=helper.HELP_RANDOM_LONG, aliases=['rand'])