diff --git a/requirements.txt b/requirements.txt index a6b7ce5..65ed351 100644 --- a/requirements.txt +++ b/requirements.txt @@ -7,4 +7,4 @@ feedparser==6.0.8 # rss feed (news) discord-py-slash-command==3.0.1 # slash commands python_dotenv==0.19.0 # using .env file wavelink==0.9.10 # music | to know the version of lavalink used, see the repo -discord-together==1.1.1 # for the party games +discord-together==1.2.1 # for the party games diff --git a/src/cogs/partygames.py b/src/cogs/partygames.py index 26fbce1..83a64b9 100644 --- a/src/cogs/partygames.py +++ b/src/cogs/partygames.py @@ -1,8 +1,7 @@ import discord from discord.ext import commands -import discordTogether from discord_slash import cog_ext -from discordTogether import DiscordTogether +from discord_together import errors as dte from utils.core import mySendHidden def setup(client): @@ -13,13 +12,15 @@ class PartyGames(commands.Cog, name="Partygames"): """Discord beta "party games" dispo uniquement sur PC.""" def __init__(self, client): self.client = client - self.togetherControl = DiscordTogether(client) self.appList = { # appNameForDiscord - (AppNameForConsumer, AppImage) "youtube": ("Youtube Together", "https://logo-logos.com/wp-content/uploads/2016/11/YouTube_icon_logo.png"), "poker": ("Poker Night", "https://images.launchbox-app.com/21782afd-4f83-492a-b199-38404d743e57.png"), "chess": ("Chess in the Park", "https://images.discordapp.net/avatars/716382796108660826/e52b79451f4d00cb04a4aca3099210a7.png?size=512"), "betrayal": ("Betrayal.io", "https://1.bp.blogspot.com/-uaqT13tY30Q/X_kqsiBJqTI/AAAAAAAADRw/R5ekQuGsO08dlBlgzXZbHktF3ioHmwmPQCLcBGAsYHQ/w1200-h630-p-k-no-nu/icon%2B%25283%2529.png"), - "fishing": ("Fishington.io", None) + "fishing": ("Fishington.io", None), + "letter-tile": ("Letter Tile", None), + "word-snack": ("Word Snack", "https://image.winudf.com/v2/image/Y29tLmFwbmF4LndvcmRzbmFja19zY3JlZW5fNF8xNTM3NzE5OTkzXzAxNg/screen-4.jpg?fakeurl=1&type=.jpg"), + "doodle-crew": ("Doodle Crew", None) } @commands.command(name='app', hidden = True) @@ -35,10 +36,10 @@ class PartyGames(commands.Cog, name="Partygames"): except: pass try: - link = await self.togetherControl.create_link(ctx.author.voice.channel.id, app) + link = await self.client.togetherControl.create_link(ctx.author.voice.channel.id, app) except AttributeError: return await mySendHidden(ctx, fromSlash, "Vous devez d'abord être dans un salon vocal avant de faire cette commande.") - except discordTogether.errors.InvalidActivityChoice: + except dte.InvalidArgument: return await mySendHidden(ctx, fromSlash, "Cette application n'est pas reconnu par Discord.") embed = discord.Embed(title = "Party Games", description = f"[Lancer *{appName}*]({link}) !") if appImage: @@ -91,3 +92,30 @@ class PartyGames(commands.Cog, name="Partygames"): async def __fishing(self, ctx): """Slash command""" return await self._fishing(ctx, True) + + @commands.command(name='letter-tile') + async def _letterTile(self, ctx, fromSlash = None): + """Créer une instance "Letter Tile".""" + return await self._linkCreator(ctx, "letter-tile", fromSlash) + @cog_ext.cog_slash(name="letter-tile", description = "Créer une instance \"Letter Tile\".") + async def __letterTile(self, ctx): + """Slash command""" + return await self._letterTile(ctx, True) + + @commands.command(name='word-snack') + async def _wordSnack(self, ctx, fromSlash = None): + """Créer une instance "Word Snack".""" + return await self._linkCreator(ctx, "word-snack", fromSlash) + @cog_ext.cog_slash(name="word-snack", description = "Créer une instance \"Word Snack\".") + async def __wordSnack(self, ctx): + """Slash command""" + return await self._wordSnack(ctx, True) + + @commands.command(name='doodle-crew') + async def _doodleCrew(self, ctx, fromSlash = None): + """Créer une instance "Doodle Crew".""" + return await self._linkCreator(ctx, "doodle-crew", fromSlash) + @cog_ext.cog_slash(name="doodle-crew", description = "Créer une instance \"Doodle Crew\".") + async def __doodleCrew(self, ctx): + """Slash command""" + return await self._doodleCrew(ctx, True) diff --git a/src/main.py b/src/main.py index 4264150..8e7f7f7 100644 --- a/src/main.py +++ b/src/main.py @@ -6,6 +6,7 @@ from discord_slash import SlashCommand from discord.ext import commands from utils.core import load, addReaction from utils.page import listReaction +from discord_together import DiscordTogether keys = load(["PREFIX", "TOKEN_DISCORD", "DEACTIVATE"]) customPrefix = keys["PREFIX"] @@ -48,6 +49,7 @@ async def on_ready(update_changePresence = False): """Triggered when the bot is ready to operate""" await client.change_presence(status = discord.Status.online, activity = discord.Activity(name = f"{customPrefix}help · {len(client.guilds)} serveur{'s' if len(client.guilds) > 1 else ''}", type = discord.ActivityType.playing)) if update_changePresence == False: + client.togetherControl = await DiscordTogether(keys["TOKEN_DISCORD"]) print("Bot prêt.") @client.event