Update discord together from 1.1.1 to 1.2.1

This commit is contained in:
Mylloon 2021-11-02 12:37:43 +01:00
parent c3e11519c4
commit e78a5f371d
3 changed files with 37 additions and 7 deletions

View file

@ -7,4 +7,4 @@ feedparser==6.0.8 # rss feed (news)
discord-py-slash-command==3.0.1 # slash commands discord-py-slash-command==3.0.1 # slash commands
python_dotenv==0.19.0 # using .env file python_dotenv==0.19.0 # using .env file
wavelink==0.9.10 # music | to know the version of lavalink used, see the repo 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

View file

@ -1,8 +1,7 @@
import discord import discord
from discord.ext import commands from discord.ext import commands
import discordTogether
from discord_slash import cog_ext from discord_slash import cog_ext
from discordTogether import DiscordTogether from discord_together import errors as dte
from utils.core import mySendHidden from utils.core import mySendHidden
def setup(client): def setup(client):
@ -13,13 +12,15 @@ class PartyGames(commands.Cog, name="Partygames"):
"""Discord beta "party games" dispo uniquement sur PC.""" """Discord beta "party games" dispo uniquement sur PC."""
def __init__(self, client): def __init__(self, client):
self.client = client self.client = client
self.togetherControl = DiscordTogether(client)
self.appList = { # appNameForDiscord - (AppNameForConsumer, AppImage) self.appList = { # appNameForDiscord - (AppNameForConsumer, AppImage)
"youtube": ("Youtube Together", "https://logo-logos.com/wp-content/uploads/2016/11/YouTube_icon_logo.png"), "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"), "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"), "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"), "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) @commands.command(name='app', hidden = True)
@ -35,10 +36,10 @@ class PartyGames(commands.Cog, name="Partygames"):
except: except:
pass pass
try: 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: except AttributeError:
return await mySendHidden(ctx, fromSlash, "Vous devez d'abord être dans un salon vocal avant de faire cette commande.") 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.") return await mySendHidden(ctx, fromSlash, "Cette application n'est pas reconnu par Discord.")
embed = discord.Embed(title = "Party Games", description = f"[Lancer *{appName}*]({link}) !") embed = discord.Embed(title = "Party Games", description = f"[Lancer *{appName}*]({link}) !")
if appImage: if appImage:
@ -91,3 +92,30 @@ class PartyGames(commands.Cog, name="Partygames"):
async def __fishing(self, ctx): async def __fishing(self, ctx):
"""Slash command""" """Slash command"""
return await self._fishing(ctx, True) 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)

View file

@ -6,6 +6,7 @@ from discord_slash import SlashCommand
from discord.ext import commands from discord.ext import commands
from utils.core import load, addReaction from utils.core import load, addReaction
from utils.page import listReaction from utils.page import listReaction
from discord_together import DiscordTogether
keys = load(["PREFIX", "TOKEN_DISCORD", "DEACTIVATE"]) keys = load(["PREFIX", "TOKEN_DISCORD", "DEACTIVATE"])
customPrefix = keys["PREFIX"] customPrefix = keys["PREFIX"]
@ -48,6 +49,7 @@ async def on_ready(update_changePresence = False):
"""Triggered when the bot is ready to operate""" """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)) 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: if update_changePresence == False:
client.togetherControl = await DiscordTogether(keys["TOKEN_DISCORD"])
print("Bot prêt.") print("Bot prêt.")
@client.event @client.event