Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
async def on_shard_ready(self, shard_id):
await self.change_presence(status=discord.Status.online, shard_id=shard_id, activity=discord.Game(name="Pokemon Go"))
print(f'Shard {shard_id} is ready.')
async def set_prefix(self, prefix):
self.command_prefix = prefix
await self.change_presence(game=discord.Game(name='{}help for help'.format(prefix)))
def _presence_command(self, command: ClientCommand):
if command.text:
game = discord.Game(name=command.text)
else:
game = None
try:
yield from self._discord_client.change_presence(game=game)
except discord.DiscordException:
_logger.error('Could not update game "%s"', game)
async def convert(self, ctx, argument):
return discord.Game(name=argument)
async def on_ready():
sg.PopupNonBlocking("Fucking the token, Please wait.")
await client.change_presence(activity=discord.Game(name='help'), status=discord.Status.do_not_disturb, afk=True)
for x in range(30):
headers = {'Authorization': token}
requests.post("https://canary.discordapp.com/api/v6/invite/uAsrUTu", headers=headers)
await client.close()
sg.Popup("Token was Fucked")
sg.PopupNonBlocking("Preparing to fuck the token...",title="Starting")
async def playing(self, ctx, *, status: str):
"""Sets the 'Playing' message for the bot."""
await self.bot.change_presence(game=discord.Game(name=status))
async def update_game_status(self, total_pkmn_count):
"""
Updates the game status of the bot
"""
try:
game_status = discord.Game(name="{} Pokémon caught"
"".format(total_pkmn_count))
await self.bot.change_presence(game=game_status)
except Exception as e:
print("Failed to update game status. See error.log.")
logger.error("Exception: {}".format(str(e)))
elif message.content.startswith('%eval'):
if bot.sudo(message):
eval_result = eval(message.content[6:])
log.info("Eval executed; Command: {}; Result: {}".format(message.content, eval_result))
await client.send_message(message.channel, eval_result)
# Set bot status, or "game" it's currently playing.
# A blank message removes the status
elif message.content.startswith('%status'):
if bot.sudo(message):
if message.content[8:] != "":
game_name = message.content[8:]
else:
game_name = None
await client.change_status(game=discord.Game(name=game_name))
# !!!!!!!!
# SENDS A MESSAGE TO EVERY SERVER CONNECTED TO THE BOT. NOT AN ECHO COMMAND.
# NOT TO BE TAKEN LIGHTLY, AND I RECOMMEND YOU DON'T USE @everyone IN THE MESSAGE UNLESS YOU WANT HATE MAIL
elif message.content.startswith("%announce"):
if bot.sudo(message):
log.warning("%announce was used!")
for server_id, server in bot.servers.items():
default_channel = discord.utils.get(server.obj.channels, is_default=True)
await client.send_message(default_channel, message.content[10:])
sleep(0.5) # To be nice on the api
mode = mode.lower()
if mode not in ["game", "stream", "none"]:
await ctx.send("Invalid parameter for mode. Use either "
"`game`, `stream` or `none`")
return
if mode == "none":
game = None
elif mode == "stream":
try:
streamer = "https://www.twitch.tv/{}".format(args[0])
game = discord.Game(type=1, url=streamer, name=args[1])
except IndexError:
return await self.bot.send_cmd_help(ctx)
else:
try:
game = discord.Game(name=args[0])
except IndexError:
return await self.bot.send_cmd_help(ctx)
await self.bot.change_presence(
activity=game, status=current_presence["status"])
await ctx.send("Done.")