Fixing errors due to new discor d library

This commit is contained in:
Rafael Vargas
2022-07-27 11:27:38 -03:00
parent fededdbb8c
commit beb0bc085d
25 changed files with 61 additions and 103 deletions

View File

@@ -1,10 +1,9 @@
from discord import Embed
from discord.ext import commands
from discord.ext.commands import Cog
from discord.ext.commands import Cog, command
from Config.Configs import Configs
from Config.Helper import Helper
from Config.Colors import Colors
from Music.MusicBot import VulkanBot
from Music.VulkanBot import VulkanBot
from Views.Embeds import Embeds
helper = Helper()
@@ -14,10 +13,7 @@ class ControlCog(Cog):
"""Class to handle discord events"""
def __init__(self, bot: VulkanBot):
print('Eae3')
self.__bot = bot
print(self.__bot)
print(bot.extensions)
self.__config = Configs()
self.__colors = Colors()
self.__embeds = Embeds()
@@ -30,7 +26,7 @@ class ControlCog(Cog):
}
@commands.command(name="help", help=helper.HELP_HELP, description=helper.HELP_HELP_LONG, aliases=['h', 'ajuda'])
@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 != '':
for command in self.__bot.commands:
@@ -81,7 +77,7 @@ class ControlCog(Cog):
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'])
@command(name='invite', help=helper.HELP_INVITE, description=helper.HELP_INVITE_LONG, aliases=['convite', 'inv', 'convidar'])
async def invite_bot(self, ctx):
invite_url = self.__config.INVITE_URL.format(self.__bot.user.id)
txt = self.__config.INVITE_MESSAGE.format(invite_url, invite_url)

View File

@@ -1,6 +1,5 @@
from discord import Guild, Client
from discord.ext import commands
from discord.ext.commands import Context
from discord.ext.commands import Context, command, Cog
from Config.Helper import Helper
from Handlers.ClearHandler import ClearHandler
from Handlers.MoveHandler import MoveHandler
@@ -23,7 +22,7 @@ from Views.EmbedView import EmbedView
helper = Helper()
class MusicCog(commands.Cog):
class MusicCog(Cog):
"""
Class to listen to Music commands
It'll listen for commands from discord, when triggered will create a specific Handler for the command
@@ -33,7 +32,7 @@ class MusicCog(commands.Cog):
def __init__(self, bot) -> None:
self.__bot: Client = bot
@commands.command(name="play", help=helper.HELP_PLAY, description=helper.HELP_PLAY_LONG, aliases=['p', 'tocar'])
@command(name="play", help=helper.HELP_PLAY, description=helper.HELP_PLAY_LONG, aliases=['p', 'tocar'])
async def play(self, ctx: Context, *args) -> None:
try:
controller = PlayHandler(ctx, self.__bot)
@@ -47,7 +46,7 @@ class MusicCog(commands.Cog):
except Exception as e:
print(f'[ERROR IN COG] -> {e}')
@commands.command(name="queue", help=helper.HELP_QUEUE, description=helper.HELP_QUEUE_LONG, aliases=['q', 'fila', 'musicas'])
@command(name="queue", help=helper.HELP_QUEUE, description=helper.HELP_QUEUE_LONG, aliases=['q', 'fila', 'musicas'])
async def queue(self, ctx: Context) -> None:
try:
controller = QueueHandler(ctx, self.__bot)
@@ -58,7 +57,7 @@ class MusicCog(commands.Cog):
except Exception as e:
print(f'[ERROR IN COG] -> {e}')
@commands.command(name="skip", help=helper.HELP_SKIP, description=helper.HELP_SKIP_LONG, aliases=['s', 'pular', 'next'])
@command(name="skip", help=helper.HELP_SKIP, description=helper.HELP_SKIP_LONG, aliases=['s', 'pular', 'next'])
async def skip(self, ctx: Context) -> None:
try:
controller = SkipHandler(ctx, self.__bot)
@@ -73,7 +72,7 @@ class MusicCog(commands.Cog):
except Exception as e:
print(f'[ERROR IN COG] -> {e}')
@commands.command(name='stop', help=helper.HELP_STOP, description=helper.HELP_STOP_LONG, aliases=['parar'])
@command(name='stop', help=helper.HELP_STOP, description=helper.HELP_STOP_LONG, aliases=['parar'])
async def stop(self, ctx: Context) -> None:
try:
controller = StopHandler(ctx, self.__bot)
@@ -88,7 +87,7 @@ class MusicCog(commands.Cog):
except Exception as e:
print(f'[ERROR IN COG] -> {e}')
@commands.command(name='pause', help=helper.HELP_PAUSE, description=helper.HELP_PAUSE_LONG, aliases=['pausar', 'pare'])
@command(name='pause', help=helper.HELP_PAUSE, description=helper.HELP_PAUSE_LONG, aliases=['pausar', 'pare'])
async def pause(self, ctx: Context) -> None:
try:
controller = PauseHandler(ctx, self.__bot)
@@ -101,7 +100,7 @@ class MusicCog(commands.Cog):
except Exception as e:
print(f'[ERROR IN COG] -> {e}')
@commands.command(name='resume', help=helper.HELP_RESUME, description=helper.HELP_RESUME_LONG, aliases=['soltar', 'despausar'])
@command(name='resume', help=helper.HELP_RESUME, description=helper.HELP_RESUME_LONG, aliases=['soltar', 'despausar'])
async def resume(self, ctx: Context) -> None:
try:
controller = ResumeHandler(ctx, self.__bot)
@@ -114,7 +113,7 @@ class MusicCog(commands.Cog):
except Exception as e:
print(f'[ERROR IN COG] -> {e}')
@commands.command(name='prev', help=helper.HELP_PREV, description=helper.HELP_PREV_LONG, aliases=['anterior', 'return', 'previous', 'back'])
@command(name='prev', help=helper.HELP_PREV, description=helper.HELP_PREV_LONG, aliases=['anterior', 'return', 'previous', 'back'])
async def prev(self, ctx: Context) -> None:
try:
controller = PrevHandler(ctx, self.__bot)
@@ -128,7 +127,7 @@ class MusicCog(commands.Cog):
except Exception as e:
print(f'[ERROR IN COG] -> {e}')
@commands.command(name='history', help=helper.HELP_HISTORY, description=helper.HELP_HISTORY_LONG, aliases=['historico', 'anteriores', 'hist'])
@command(name='history', help=helper.HELP_HISTORY, description=helper.HELP_HISTORY_LONG, aliases=['historico', 'anteriores', 'hist'])
async def history(self, ctx: Context) -> None:
try:
controller = HistoryHandler(ctx, self.__bot)
@@ -141,7 +140,7 @@ class MusicCog(commands.Cog):
except Exception as e:
print(f'[ERROR IN COG] -> {e}')
@commands.command(name='loop', help=helper.HELP_LOOP, description=helper.HELP_LOOP_LONG, aliases=['l', 'repeat'])
@command(name='loop', help=helper.HELP_LOOP, description=helper.HELP_LOOP_LONG, aliases=['l', 'repeat'])
async def loop(self, ctx: Context, args='') -> None:
try:
controller = LoopHandler(ctx, self.__bot)
@@ -154,7 +153,7 @@ class MusicCog(commands.Cog):
except Exception as e:
print(f'[ERROR IN COG] -> {e}')
@commands.command(name='clear', help=helper.HELP_CLEAR, description=helper.HELP_CLEAR_LONG, aliases=['c', 'limpar'])
@command(name='clear', help=helper.HELP_CLEAR, description=helper.HELP_CLEAR_LONG, aliases=['c', 'limpar'])
async def clear(self, ctx: Context) -> None:
try:
controller = ClearHandler(ctx, self.__bot)
@@ -165,7 +164,7 @@ class MusicCog(commands.Cog):
except Exception as e:
print(f'[ERROR IN COG] -> {e}')
@commands.command(name='np', help=helper.HELP_NP, description=helper.HELP_NP_LONG, aliases=['playing', 'now', 'this'])
@command(name='np', help=helper.HELP_NP, description=helper.HELP_NP_LONG, aliases=['playing', 'now', 'this'])
async def now_playing(self, ctx: Context) -> None:
try:
controller = NowPlayingHandler(ctx, self.__bot)
@@ -178,7 +177,7 @@ class MusicCog(commands.Cog):
except Exception as e:
print(f'[ERROR IN COG] -> {e}')
@commands.command(name='shuffle', help=helper.HELP_SHUFFLE, description=helper.HELP_SHUFFLE_LONG, aliases=['aleatorio', 'misturar'])
@command(name='shuffle', help=helper.HELP_SHUFFLE, description=helper.HELP_SHUFFLE_LONG, aliases=['aleatorio', 'misturar'])
async def shuffle(self, ctx: Context) -> None:
try:
controller = ShuffleHandler(ctx, self.__bot)
@@ -191,7 +190,7 @@ class MusicCog(commands.Cog):
except Exception as e:
print(f'[ERROR IN COG] -> {e}')
@commands.command(name='move', help=helper.HELP_MOVE, description=helper.HELP_MOVE_LONG, aliases=['m', 'mover'])
@command(name='move', help=helper.HELP_MOVE, description=helper.HELP_MOVE_LONG, aliases=['m', 'mover'])
async def move(self, ctx: Context, pos1, pos2='1') -> None:
try:
controller = MoveHandler(ctx, self.__bot)
@@ -204,7 +203,7 @@ class MusicCog(commands.Cog):
except Exception as e:
print(f'[ERROR IN COG] -> {e}')
@commands.command(name='remove', help=helper.HELP_REMOVE, description=helper.HELP_REMOVE_LONG, aliases=['remover'])
@command(name='remove', help=helper.HELP_REMOVE, description=helper.HELP_REMOVE_LONG, aliases=['remover'])
async def remove(self, ctx: Context, position) -> None:
try:
controller = RemoveHandler(ctx, self.__bot)
@@ -217,7 +216,7 @@ class MusicCog(commands.Cog):
except Exception as e:
print(f'[ERROR IN COG] -> {e}')
@commands.command(name='reset', help=helper.HELP_RESET, description=helper.HELP_RESET_LONG, aliases=['resetar'])
@command(name='reset', help=helper.HELP_RESET, description=helper.HELP_RESET_LONG, aliases=['resetar'])
async def reset(self, ctx: Context) -> None:
try:
controller = ResetHandler(ctx, self.__bot)
@@ -232,6 +231,4 @@ 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 Music.MusicBot import VulkanBot
from Music.VulkanBot import VulkanBot
from discord.ext.commands import Context, command, Cog
from Config.Helper import Helper
from Views.Embeds import Embeds
@@ -11,9 +11,6 @@ class RandomCog(Cog):
"""Class to listen to commands of type Random"""
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'])