database.cur.execute( "SELECT discordid, username, team FROM playerTable;") allplayers = database.cur.fetchall() for id, name, team in allplayers: if bot.guild.get_member(id) == None: if team != None: database.cur.execute( "UPDATE playertable SET team=NULL WHERE discordid=%s;" % id) await ctx.send(name) database.conn.commit() await ctx.send("**Done**") @commands.command(pass_context=True) @commands.is_owner() async def dostuff(self, ctx): """do stuff""" database.cur.execute("SELECT teamname, captainid FROM teamtable;") allteams = database.cur.fetchall() for team, captain in allteams: member = bot.guild.get_member(captain) if member == None: await teams.disband_team( team, "Your team has been disbanded because your captain has left the server." ) await ctx.send("Done") bot.add_cog(Owner())
def setup(bot): bot.add_cog(SafeImage(bot))
def setup(bot: bot) -> None: """Set up the Trivia Questions Cog.""" from ._cog import TriviaQuiz bot.add_cog(TriviaQuiz(bot))
def setup(bot): bot.add_cog(Confess(bot))
(targetusername, team)) await utils.log( "%s made %s the owner of %s." % (database.username(ctx.author.id), targetusername, team)) @commands.command(pass_context=True) @checks.is_captain() async def editroster(self, ctx): """set primary and substitute team members""" #check that the user is the captain of a team database.cur.execute( "SELECT teamname FROM teamTable WHERE captainID=%s;" % ctx.author.id) team = database.cur.fetchone()[0] database.cur.execute( "SELECT discordID FROM playerTable WHERE team='%s';" % team) players = database.cur.fetchall() msg = "Please select your team's primary players.\nThen select ✅ ." index = 0 for p in players: msg += "\n%s %s" % (bot.LIST_EMOJIS[index], bot.get_user( p[0]).mention) index += 1 message = await ctx.author.send(msg) for i in range(index): await message.add_reaction(bot.LIST_EMOJIS[i]) await message.add_reaction("✅") bot.add_cog(Teams())
def setup(bot): bot.add_cog(PrivateCommands(bot))
"UPDATE playerTable SET lastCommendTime='%s' WHERE discordID=%s;" % (now, ctx.author.id)) database.conn.commit() targetusername = database.username(player.id) await ctx.send("You have commended %s." % targetusername) await utils.log("%s commended %s." % (database.username(ctx.author.id), targetusername)) @commands.command(pass_context=True) @checks.is_registered() async def report(self, ctx, target: CGLUser, *, reason): """reports another player's behaviour Reports another player's behavior. The player can be specified by one of three methods: mentioning the player, giving the player's full Discord tag, the player's CGL username (or server specific nickname) A reason must be provided after the player who is being reported.""" if target == None: await ctx.send("There was a problem identifying that player.") return if reason == None: await ctx.send("Please provide a reason for reporting the player.") return await ctx.send("Report submitted for %s." % target.mention) await bot.guild.get_channel(bot.REPORTS_CHANNEL).send( "%s reported %s for: %s" % (ctx.author.mention, target.mention, reason)) bot.add_cog(General())
def setup(bot): bot.add_cog(Bookmarks(bot))
await ctx.send("Server start map has been changed.") else: await ctx.send("There was an error editing the server settings.") @edit.command(pass_context=True) @commands.has_role('Admin') async def location(self, ctx, servername, location): scode = servers.edit_server(servers.server_id(servername), {'location':location}) if scode == 200: await ctx.send("Server location has been changed.") else: await ctx.send("There was an error editing the server settings.") @edit.command(pass_context=True) @commands.has_role('Admin') async def name(self, ctx, servername, newname): scode = servers.edit_server(servers.server_id(servername), {'name':newname}) if scode == 200: await ctx.send("Server name has been changed.") else: await ctx.send("There was an error editing the server settings.") @edit.command(pass_context=True) @commands.has_role('Admin') async def slots(self, ctx, servername, slots: int): scode = servers.edit_server(servers.server_id(servername), {'csgo_settings.slots':slots}) if scode == 200: await ctx.send("Server size has been changed.") else: await ctx.send("There was an error editing the server settings.") bot.add_cog(Admin())
def setup(bot): bot.add_cog(Website(bot))
def setup(bot: bot.Bot) -> None: """Load the Pride Leader Cog.""" bot.add_cog(PrideLeader(bot))
from bot import bot, TOKEN from bot.cogs.basic import BasicCog from bot.cogs.dog import DogCog # Add cogs (blueprints) to bot and run bot.add_cog(BasicCog(bot)) bot.add_cog(DogCog(bot)) bot.run(TOKEN)
valid_stats = ["elo", "rep"] if stat.lower() not in valid_stats: await ctx.send( "%s is not a valid sort parameter. Use !help leaderboard for more info." ) page -= 1 database.cur.execute( "SELECT discordID, %s FROM playerTable ORDER BY %s DESC;" % (stat, stat)) players = database.cur.fetchall() playercount = len(players) rank = page * 10 end = rank + 10 if end >= playercount: end = -1 e = discord.Embed(colour=discord.Colour.blue()) str = "" for id, ustat in players[rank:end]: user = bot.get_user(id) if user != None: rank += 1 str += "\n%s) %s - %s" % (rank, user.mention, ustat) e.add_field(name="Leaderboard - %s" % stat, value=str) e.set_footer(text="Page %s of %s" % (page + 1, math.ceil(playercount / 10))) await ctx.send(embed=e) bot.add_cog(Stats())