Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
@checks.is_owner()
async def _wcset_upload(self, ctx, link: str=None):
"""Upload an image mask through Discord"""
user = ctx.message.author
server = ctx.message.server
attach = ctx.message.attachments
emoji = ('\N{WHITE HEAVY CHECK MARK}', '\N{CROSS MARK}')
if len(attach) > 1 or (attach and link):
await self.bot.say("Please add one image at a time.")
return
url = ""
filename = ""
if attach:
a = attach[0]
url = a["url"]
filename = a["filename"]
@checks.is_owner()
async def clubs_delete(self, ctx, clankey):
"""Remove a clan from tracking"""
clankey = clankey.lower()
if await self.clubs.delClan(clankey):
return await self.bot.say("Success")
else:
await self.bot.say("Failed")
@checks.is_owner()
async def fullping(self, ctx, amount: int=10):
"""More intensive ping, gives debug info on reaction times.
- amount (optional): The amount of pings to do
"""
if not 1 < amount < 200:
await ctx.send('Please choose a more reasonable amount of pings.')
return
please_wait_message = await ctx.send('Please wait, this will take a while...')
await ctx.trigger_typing()
values = []
for i in range(0, amount):
before = time.monotonic()
await (await self.liara.ws.ping())
after = time.monotonic()
delta = (after - before) * 1000
@checks.is_owner()
async def stats(self, ctx):
"""Server Stats settings"""
if ctx.invoked_subcommand is None:
await send_cmd_help(ctx)
@checks.is_owner()
@commands.command(hidden=True)
async def updateartifact(self, ctx):
"""Updates all the artifact card data"""
await self.update_card_sets()
await ctx.message.add_reaction("✅")
@checks.is_owner()
async def clanchesttrack(self, ctx):
"""Start tracking clanchest"""
await self.bot.say("Clan Chest Tracking started...")
loop = asyncio.get_event_loop()
loop.create_task(self.checkChest(ctx))
async def serverinfo(self, ctx: NabCtx, server=None):
"""Shows the server's information."""
if await checks.is_owner(ctx) and server is not None:
try:
guild = self.bot.get_guild(int(server))
if guild is None:
return await ctx.error(f"I'm not in any server with ID {server}.")
except ValueError:
return await ctx.error("That is not a valid id.")
else:
guild = ctx.guild
embed = discord.Embed(title=guild.name, timestamp=guild.created_at, color=discord.Color.blurple())
embed.set_footer(text="Created on")
embed.set_thumbnail(url=guild.icon_url)
embed.add_field(name="ID", value=str(guild.id), inline=False)
if ctx.guild != guild:
embed.add_field(name="Owner", value=str(guild.owner))
else:
embed.add_field(name="Owner", value=guild.owner.mention)
@checks.is_owner()
async def name(self, ctx, *, name):
"""Sets Red's name"""
name = name.strip()
if name != "":
try:
await self.bot.edit_profile(self.bot.settings.password,
username=name)
except:
await self.bot.say("Failed to change name. Remember that you"
" can only do it up to 2 times an hour."
"Use nicknames if you need frequent "
"changes. {}set nickname"
"".format(ctx.prefix))
else:
await self.bot.say("Done.")
else:
@checks.is_owner()
async def audioset_maxlength(self, length: int):
"""Maximum track length (seconds) for requested links"""
if length <= 0:
await self.bot.say("Wow, a non-positive length value...aren't"
" you smart.")
return
self.settings["MAX_LENGTH"] = length
await self.bot.say("Maximum length is now {} seconds.".format(length))
self.save_settings()
@checks.is_owner()
@remimage.command(hidden=True, pass_context=True, name="global")
async def rem_image_global(self, ctx, cmd):
"""Remove a selected images"""
author = ctx.message.author
server = ctx.message.server
channel = ctx.message.channel
cmd = cmd.lower()
if cmd not in self.images["global"]:
await self.bot.say("{} is not a global image!".format(cmd))
return
os.remove(self.images["global"][cmd])
del self.images["global"][cmd]
dataIO.save_json("data/addimage/settings.json", self.images)
await self.bot.say("{} has been deleted globally!".format(cmd))