async def ebot(self, ctx, *user): """Lien de l'eBot""" if not is_command_enabled('ebot'): await ctx.send(disabled_command.format(ctx)) return msg = "" args = "" link = config.URL_EBOT if is_in_group(ctx, config.ADMIN_ROLE) and user: for each_user in user: msg = msg + "{0} ".format(each_user) args = msg else: msg = "{0.message.author.mention} ".format(ctx) msg = msg + "-> Lien de l'eBot : {0}".format(link) embed = logs.create_log(self.bot.user.avatar_url, "", "User ID : {0}".format(ctx.message.author.id), static_var.hex_colors_codes['green'], ctx.message.author.name, ctx.message.author.avatar_url, "Action", "Command used", "Name", "!ebot", "Arguments", args) await self.bot.get_channel(config.COMMAND_LOGS).send(embed=embed) await ctx.send(msg)
async def report(self, ctx, *user): """Avoir des informations pour reporter un(e) joueur/équipe""" if not is_command_enabled('report'): await ctx.send(disabled_command.format(ctx)) return msg = "" args = "" link = config.URL_ADMINAFK + 'pages/participants.php' if is_in_group(ctx, config.ADMIN_ROLE) and user: for each_user in user: msg = msg + "{0} ".format(each_user) args = msg else: msg = msg + "{0.message.author.mention} ".format(ctx) msg = msg + " pour faire une demande de gotv vous devez spécifier le match incriminé ainsi que potentiellement les joueurs incriminés. Suite à cela nous vous donnerons un lien que vous devrez regarder et trouver les ticks que vous trouvez suspects (3 minimums)".format( link) await self.bot.get_channel(config.GOTV_CHANNEL).send(msg) embed = logs.create_log(self.bot.user.avatar_url, "", "User ID : {0}".format(ctx.message.author.id), static_var.hex_colors_codes['green'], ctx.message.author.name, ctx.message.author.avatar_url, "Action", "Command used", "Name", "!report", "Arguments", args) await self.bot.get_channel(config.COMMAND_LOGS).send(embed=embed)
async def status(self, ctx, command: str): """Status d'une commande""" if command in ['enable', 'disable', 'status']: msg = '{0.message.author.mention} -> La commande !enable, !disable et !status sont toujours activées'.format( ctx) else: if not command in static_var.status_commands: msg = _( "{0.message.author.mention} -> Command !{1} doesn't exists" ).format(ctx, command) else: if is_command_enabled(command): msg = _( '{0.message.author.mention} -> Command !{1} is active' ).format(ctx, command) else: msg = _( '{0.message.author.mention} -> Command !{1} is disabled' ).format(ctx, command) await self.bot.log("Status", "", "green", ctx.message.author, "Action", "Command used", "Name", "!status", "Argument", command) await ctx.send(msg)
async def ping(self, ctx): """Test the connectivty of the bot Sennd a typing notification and measure the acknowledgement time """ if not is_command_enabled('ping'): await ctx.send(disabled_command.format(ctx)) return t1 = time.perf_counter() async with ctx.typing(): pass t2 = time.perf_counter() msg = 'Pong: {}ms !'.format(round((t2 - t1) * 1000)) await self.bot.log("Ping", "Ping called", "green", ctx.message.author, "Action", "Command used", "Name", "!ping") await ctx.send(msg)
async def mute(self, ctx, member: discord.Member): """Mute an user""" if not is_command_enabled('mute', ): await ctx.send(disabled_command.format(ctx)) return if not is_admin(ctx): await ctx.send(restricted_command.format(ctx)) return role = discord.utils.get(member.guild.roles, name=config.MUTED_ROLE) if role in member.roles: msg = "{0.mention} est déjà muté !".format(member) else: await member.add_roles(role) msg = "{0.mention} a été muté par {1.message.author.mention} !".format( member, ctx) await self.bot.log("Mute", "Mute called", "green", ctx.message.author, "Action", "Command used", "Name", "!mute", "Arguments", member.mention) await ctx.send(msg)
async def gotv(self, ctx, *user): """Comment regarder une démo ?""" if not is_command_enabled('gotv'): await ctx.send(disabled_command.format(ctx)) return msg = "" args = "" if is_in_group(ctx, config.ADMIN_ROLE) and user: for each_user in user: msg = msg + "{0} ".format(each_user) args = msg else: msg = "{0.message.author.mention} ".format(ctx) msg = msg + "Pour regarder une démo :\n 1)Télécharge la démo\n 2)Dézippe la démo grâce à winrar par exemple\n 3)Dépose le fichier <nom>.dem dans un dossier sans accent par exemple ton bureau\n 4)Lance CS:GO\n 5)Appuye simultanément sur `Shift` et `F2`\n 6)Appuye sur Load...\n 7)Sélectionne le fichier <nom>.dem\n 8)Le jeu va lancer la démo" embed = logs.create_log(self.bot.user.avatar_url, "", "User ID : {0}".format(ctx.message.author.id), static_var.hex_colors_codes['green'], ctx.message.author.name, ctx.message.author.avatar_url, "Action", "Command used", "Name", "!gotv", "Arguments", args) await self.bot.get_channel(config.COMMAND_LOGS).send(embed=embed) await ctx.send(msg)
async def wrap(self, ctx, *args, **kwargs): # if command is disabled, noop the command and send message if not check_permissions.is_command_enabled(command): await ctx.send(disabled_command.format(ctx)) return None return await func(self, ctx, *args, **kwargs)
async def matchs(self, ctx, *user): """Avoir des informations sur les matchs en cours""" if not is_command_enabled('matchs'): await ctx.send(disabled_command.format(ctx)) return msg = "" args = "" if is_in_group(ctx, config.ADMIN_ROLE) and user: for each_user in user: msg = msg + "{0} ".format(each_user) args = msg else: msg = "{0.message.author.mention} ".format(ctx) bdd.db_connect(config.EBOT_HOSTNAME, config.EBOT_PORT, config.EBOT_DBNAME, config.EBOT_USERNAME, config.EBOT_PASSWORD) result = bdd.db_select() bdd.db_disconnect() matchs = [] status = "" for row in result: if 1 < int(row['status']) < 13: matchs.append(row) if not matchs: msg = msg + "-> Il n'y a aucun match en cours" else: msg = msg + "-> Matchs en cours : ```" for each_match in matchs: if int(each_match['enable']) == 0: status = "Stop" else: status = "Live" if each_match['teama_name'] is None: team_a = each_match['team_a_name'] else: team_a = each_match['teama_name'] if each_match['teamb_name'] is None: team_b = each_match['team_b_name'] else: team_b = each_match['teamb_name'] match = '{0} ({1}) vs {2} ({3})'.format( team_a, each_match['score_a'], team_b, each_match['score_b']) msg = msg + match i = 0 while i < 70 - (len(match) + 20): msg = msg + ' ' i = i + 1 msg = msg + '{0}({1})\n'.format( static_var.ebot_status[int(each_match['status'])], status) msg = msg + "```" embed = logs.create_log(self.bot.user.avatar_url, "", "User ID : {0}".format(ctx.message.author.id), static_var.hex_colors_codes['green'], ctx.message.author.name, ctx.message.author.avatar_url, "Action", "Command used", "Name", "!matchs", "Arguments", args) await self.bot.get_channel(config.COMMAND_LOGS).send(embed=embed) await ctx.send(msg)