mirror of
https://github.com/myned/modufur.git
synced 2024-11-01 21:02:38 +00:00
Merge branch 'dev'
This commit is contained in:
commit
31fff4ebd1
6 changed files with 77 additions and 61 deletions
|
@ -139,7 +139,6 @@ class MsG:
|
||||||
|
|
||||||
# Tag search
|
# Tag search
|
||||||
@tags.command(name='related', aliases=['relate', 'rel'], brief='e621 - Search for related tags', description='Return related tags for given tag(s)', usage='[related|relate|rel]')
|
@tags.command(name='related', aliases=['relate', 'rel'], brief='e621 - Search for related tags', description='Return related tags for given tag(s)', usage='[related|relate|rel]')
|
||||||
@checks.del_ctx()
|
|
||||||
async def _tags_related(self, ctx, *args):
|
async def _tags_related(self, ctx, *args):
|
||||||
kwargs = u.get_kwargs(ctx, args)
|
kwargs = u.get_kwargs(ctx, args)
|
||||||
dest, tags = kwargs['destination'], kwargs['remaining']
|
dest, tags = kwargs['destination'], kwargs['remaining']
|
||||||
|
@ -170,7 +169,6 @@ class MsG:
|
||||||
|
|
||||||
# Tag aliases
|
# Tag aliases
|
||||||
@tags.command(name='aliases', aliases=['alias', 'als'], brief='e621 - Search for tag aliases', description='Return aliases for given tag(s)', usage='[aliases|alias|als]')
|
@tags.command(name='aliases', aliases=['alias', 'als'], brief='e621 - Search for tag aliases', description='Return aliases for given tag(s)', usage='[aliases|alias|als]')
|
||||||
@checks.del_ctx()
|
|
||||||
async def _tags_aliases(self, ctx, *args):
|
async def _tags_aliases(self, ctx, *args):
|
||||||
kwargs = u.get_kwargs(ctx, args)
|
kwargs = u.get_kwargs(ctx, args)
|
||||||
dest, tags = kwargs['destination'], kwargs['remaining']
|
dest, tags = kwargs['destination'], kwargs['remaining']
|
||||||
|
@ -206,7 +204,6 @@ class MsG:
|
||||||
await ctx.message.add_reaction('\N{CROSS MARK}')
|
await ctx.message.add_reaction('\N{CROSS MARK}')
|
||||||
|
|
||||||
@get.command(name='info', aliases=['i'], brief='e621 - Get info from post', description='Return info for given post', usage='[info|i]')
|
@get.command(name='info', aliases=['i'], brief='e621 - Get info from post', description='Return info for given post', usage='[info|i]')
|
||||||
@checks.del_ctx()
|
|
||||||
async def _get_info(self, ctx, *args):
|
async def _get_info(self, ctx, *args):
|
||||||
try:
|
try:
|
||||||
kwargs = u.get_kwargs(ctx, args)
|
kwargs = u.get_kwargs(ctx, args)
|
||||||
|
@ -241,7 +238,6 @@ class MsG:
|
||||||
await ctx.message.add_reaction('\N{CROSS MARK}')
|
await ctx.message.add_reaction('\N{CROSS MARK}')
|
||||||
|
|
||||||
@get.command(name='image', aliases=['img'], brief='e621 - Get image link', description='Return image for given post', usage='[image|img]')
|
@get.command(name='image', aliases=['img'], brief='e621 - Get image link', description='Return image for given post', usage='[image|img]')
|
||||||
@checks.del_ctx()
|
|
||||||
async def _get_image(self, ctx, *args):
|
async def _get_image(self, ctx, *args):
|
||||||
try:
|
try:
|
||||||
kwargs = u.get_kwargs(ctx, args)
|
kwargs = u.get_kwargs(ctx, args)
|
||||||
|
@ -273,7 +269,6 @@ class MsG:
|
||||||
await ctx.message.add_reaction('\N{CROSS MARK}')
|
await ctx.message.add_reaction('\N{CROSS MARK}')
|
||||||
|
|
||||||
@get.command(name='pool', aliases=['p'], brief='e621 - Get pool link', description='Return pool info for given query', usage='[pool|p]')
|
@get.command(name='pool', aliases=['p'], brief='e621 - Get pool link', description='Return pool info for given query', usage='[pool|p]')
|
||||||
@checks.del_ctx()
|
|
||||||
async def _get_pool(self, ctx, *args):
|
async def _get_pool(self, ctx, *args):
|
||||||
def on_reaction(reaction, user):
|
def on_reaction(reaction, user):
|
||||||
if reaction.emoji == '\N{OCTAGONAL SIGN}' and reaction.message.id == ctx.message.id and user is ctx.author:
|
if reaction.emoji == '\N{OCTAGONAL SIGN}' and reaction.message.id == ctx.message.id and user is ctx.author:
|
||||||
|
@ -319,7 +314,6 @@ class MsG:
|
||||||
|
|
||||||
# Reverse image searches a linked image using the public iqdb
|
# Reverse image searches a linked image using the public iqdb
|
||||||
@commands.command(name='reverse', aliases=['rev', 'ris'], brief='e621 Reverse image search', description='e621 | NSFW\nReverse-search an image with given URL')
|
@commands.command(name='reverse', aliases=['rev', 'ris'], brief='e621 Reverse image search', description='e621 | NSFW\nReverse-search an image with given URL')
|
||||||
@checks.del_ctx()
|
|
||||||
async def reverse(self, ctx, *args):
|
async def reverse(self, ctx, *args):
|
||||||
try:
|
try:
|
||||||
kwargs = u.get_kwargs(ctx, args)
|
kwargs = u.get_kwargs(ctx, args)
|
||||||
|
@ -364,7 +358,6 @@ class MsG:
|
||||||
await ctx.message.add_reaction('\N{CROSS MARK}')
|
await ctx.message.add_reaction('\N{CROSS MARK}')
|
||||||
|
|
||||||
@commands.command(name='reversify', aliases=['revify', 'risify', 'rify'])
|
@commands.command(name='reversify', aliases=['revify', 'risify', 'rify'])
|
||||||
@checks.del_ctx()
|
|
||||||
async def reversify(self, ctx, *args):
|
async def reversify(self, ctx, *args):
|
||||||
try:
|
try:
|
||||||
kwargs = u.get_kwargs(ctx, args, limit=self.HISTORY_LIMIT / 5)
|
kwargs = u.get_kwargs(ctx, args, limit=self.HISTORY_LIMIT / 5)
|
||||||
|
@ -649,7 +642,6 @@ class MsG:
|
||||||
|
|
||||||
# Creates reaction-based paginator for linked pools
|
# Creates reaction-based paginator for linked pools
|
||||||
@commands.command(name='poolpage', aliases=['poolp', 'pp', 'e621pp', 'e6pp', '6pp'], brief='e621 pool paginator', description='e621 | NSFW\nShow pools in a page format')
|
@commands.command(name='poolpage', aliases=['poolp', 'pp', 'e621pp', 'e6pp', '6pp'], brief='e621 pool paginator', description='e621 | NSFW\nShow pools in a page format')
|
||||||
@checks.del_ctx()
|
|
||||||
async def pool_paginator(self, ctx, *args):
|
async def pool_paginator(self, ctx, *args):
|
||||||
def on_reaction(reaction, user):
|
def on_reaction(reaction, user):
|
||||||
if reaction.emoji == '\N{OCTAGONAL SIGN}' and reaction.message.id == ctx.message.id and (user is ctx.author or user.permissions_in(reaction.message.channel).manage_messages):
|
if reaction.emoji == '\N{OCTAGONAL SIGN}' and reaction.message.id == ctx.message.id and (user is ctx.author or user.permissions_in(reaction.message.channel).manage_messages):
|
||||||
|
@ -781,7 +773,6 @@ class MsG:
|
||||||
await ctx.author.send('`{} / {}`'.format(hearted.index(embed) + 1, len(hearted)), embed=embed)
|
await ctx.author.send('`{} / {}`'.format(hearted.index(embed) + 1, len(hearted)), embed=embed)
|
||||||
|
|
||||||
@commands.command(name='e621page', aliases=['e621p', 'e6p', '6p'])
|
@commands.command(name='e621page', aliases=['e621p', 'e6p', '6p'])
|
||||||
@checks.del_ctx()
|
|
||||||
@checks.is_nsfw()
|
@checks.is_nsfw()
|
||||||
async def e621_paginator(self, ctx, *args):
|
async def e621_paginator(self, ctx, *args):
|
||||||
def on_reaction(reaction, user):
|
def on_reaction(reaction, user):
|
||||||
|
@ -942,7 +933,6 @@ class MsG:
|
||||||
# await ctx.message.add_reaction('\N{NO ENTRY}')
|
# await ctx.message.add_reaction('\N{NO ENTRY}')
|
||||||
|
|
||||||
@commands.command(name='e926page', aliases=['e926p', 'e9p', '9p'])
|
@commands.command(name='e926page', aliases=['e926p', 'e9p', '9p'])
|
||||||
@checks.del_ctx()
|
|
||||||
async def e926_paginator(self, ctx, *args):
|
async def e926_paginator(self, ctx, *args):
|
||||||
def on_reaction(reaction, user):
|
def on_reaction(reaction, user):
|
||||||
if reaction.emoji == '\N{OCTAGONAL SIGN}' and reaction.message.id == ctx.message.id and (user is ctx.author or user.permissions_in(reaction.message.channel).manage_messages):
|
if reaction.emoji == '\N{OCTAGONAL SIGN}' and reaction.message.id == ctx.message.id and (user is ctx.author or user.permissions_in(reaction.message.channel).manage_messages):
|
||||||
|
@ -1097,7 +1087,6 @@ class MsG:
|
||||||
|
|
||||||
# Searches for and returns images from e621.net given tags when not blacklisted
|
# Searches for and returns images from e621.net given tags when not blacklisted
|
||||||
@commands.group(aliases=['e6', '6'], brief='e621 | NSFW', description='e621 | NSFW\nTag-based search for e621.net\n\nYou can only search 5 tags and 6 images at once for now.\ne6 [tags...] ([# of images])')
|
@commands.group(aliases=['e6', '6'], brief='e621 | NSFW', description='e621 | NSFW\nTag-based search for e621.net\n\nYou can only search 5 tags and 6 images at once for now.\ne6 [tags...] ([# of images])')
|
||||||
@checks.del_ctx()
|
|
||||||
@checks.is_nsfw()
|
@checks.is_nsfw()
|
||||||
async def e621(self, ctx, *args):
|
async def e621(self, ctx, *args):
|
||||||
try:
|
try:
|
||||||
|
@ -1147,7 +1136,6 @@ class MsG:
|
||||||
|
|
||||||
# Searches for and returns images from e926.net given tags when not blacklisted
|
# Searches for and returns images from e926.net given tags when not blacklisted
|
||||||
@commands.command(aliases=['e9', '9'], brief='e926 | SFW', description='e926 | SFW\nTag-based search for e926.net\n\nYou can only search 5 tags and 6 images at once for now.\ne9 [tags...] ([# of images])')
|
@commands.command(aliases=['e9', '9'], brief='e926 | SFW', description='e926 | SFW\nTag-based search for e926.net\n\nYou can only search 5 tags and 6 images at once for now.\ne9 [tags...] ([# of images])')
|
||||||
@checks.del_ctx()
|
|
||||||
async def e926(self, ctx, *args):
|
async def e926(self, ctx, *args):
|
||||||
try:
|
try:
|
||||||
kwargs = u.get_kwargs(ctx, args, limit=3)
|
kwargs = u.get_kwargs(ctx, args, limit=3)
|
||||||
|
@ -1189,7 +1177,6 @@ class MsG:
|
||||||
await ctx.message.add_reaction('\N{CROSS MARK}')
|
await ctx.message.add_reaction('\N{CROSS MARK}')
|
||||||
|
|
||||||
@commands.group(aliases=['fave', 'fav', 'f'])
|
@commands.group(aliases=['fave', 'fav', 'f'])
|
||||||
@checks.del_ctx()
|
|
||||||
async def favorite(self, ctx):
|
async def favorite(self, ctx):
|
||||||
if not ctx.invoked_subcommand:
|
if not ctx.invoked_subcommand:
|
||||||
await ctx.send('**Use a flag to manage favorites.**\n*Type* `{}help fav` *for more info.*'.format(ctx.prefix), delete_after=7)
|
await ctx.send('**Use a flag to manage favorites.**\n*Type* `{}help fav` *for more info.*'.format(ctx.prefix), delete_after=7)
|
||||||
|
@ -1300,7 +1287,6 @@ class MsG:
|
||||||
|
|
||||||
# Umbrella command structure to manage global, channel, and user blacklists
|
# Umbrella command structure to manage global, channel, and user blacklists
|
||||||
@commands.group(aliases=['bl', 'b'], brief='Manage blacklists', description='Blacklist base command for managing blacklists\n\n`bl get [blacklist]` to show a blacklist\n`bl set [blacklist] [tags]` to replace a blacklist\n`bl clear [blacklist]` to clear a blacklist\n`bl add [blacklist] [tags]` to add tags to a blacklist\n`bl remove [blacklist] [tags]` to remove tags from a blacklist', usage='[flag] [blacklist] ([tags])')
|
@commands.group(aliases=['bl', 'b'], brief='Manage blacklists', description='Blacklist base command for managing blacklists\n\n`bl get [blacklist]` to show a blacklist\n`bl set [blacklist] [tags]` to replace a blacklist\n`bl clear [blacklist]` to clear a blacklist\n`bl add [blacklist] [tags]` to add tags to a blacklist\n`bl remove [blacklist] [tags]` to remove tags from a blacklist', usage='[flag] [blacklist] ([tags])')
|
||||||
@checks.del_ctx()
|
|
||||||
async def blacklist(self, ctx):
|
async def blacklist(self, ctx):
|
||||||
if not ctx.invoked_subcommand:
|
if not ctx.invoked_subcommand:
|
||||||
await ctx.send('**Use a flag to manage blacklists.**\n*Type* `{}help bl` *for more info.*'.format(ctx.prefix), delete_after=7)
|
await ctx.send('**Use a flag to manage blacklists.**\n*Type* `{}help bl` *for more info.*'.format(ctx.prefix), delete_after=7)
|
||||||
|
|
|
@ -28,10 +28,18 @@ class Administration:
|
||||||
self.deleting = True
|
self.deleting = True
|
||||||
self.bot.loop.create_task(self.delete())
|
self.bot.loop.create_task(self.delete())
|
||||||
|
|
||||||
@commands.command(name=',prunefromguild', aliases=[',pfg', ',prunefromserver', ',pfs'], brief='Prune a user\'s messages from the guild', description='about flag centers on message 50 of 101 messages\n\npfg \{user id\} [before|after|about] [\{message id\}]\n\nExample:\npfg \{user id\} before \{message id\}')
|
@commands.group(aliases=['pru', 'clear', 'cl'], hidden=True)
|
||||||
@commands.is_owner()
|
@commands.is_owner()
|
||||||
@checks.del_ctx()
|
async def prune(self, ctx):
|
||||||
async def prune_all_user(self, ctx, user, when=None, reference=None):
|
pass
|
||||||
|
|
||||||
|
@prune.group(name='user', aliases=['u', 'member', 'm'])
|
||||||
|
async def _prune_user(self, ctx):
|
||||||
|
pass
|
||||||
|
|
||||||
|
@_prune_user.command(name='all', aliases=['a'], brief='Prune a user\'s messages from the guild', description='about flag centers on message 50 of 101 messages\n\npfg \{user id\} [before|after|about] [\{message id\}]\n\nExample:\npfg \{user id\} before \{message id\}', hidden=True)
|
||||||
|
@commands.is_owner()
|
||||||
|
async def _prune_user_all(self, ctx, user, when=None, reference=None):
|
||||||
def yes(msg):
|
def yes(msg):
|
||||||
if msg.content.lower() == 'y' and msg.channel is ctx.channel and msg.author is ctx.author:
|
if msg.content.lower() == 'y' and msg.channel is ctx.channel and msg.author is ctx.author:
|
||||||
return True
|
return True
|
||||||
|
@ -147,7 +155,6 @@ class Administration:
|
||||||
|
|
||||||
@commands.command(name='autodelete', aliases=['autodel'])
|
@commands.command(name='autodelete', aliases=['autodel'])
|
||||||
@commands.has_permissions(administrator=True)
|
@commands.has_permissions(administrator=True)
|
||||||
@checks.del_ctx()
|
|
||||||
async def auto_delete(self, ctx):
|
async def auto_delete(self, ctx):
|
||||||
try:
|
try:
|
||||||
if ctx.channel.id not in u.tasks['auto_del']:
|
if ctx.channel.id not in u.tasks['auto_del']:
|
||||||
|
@ -166,9 +173,13 @@ class Administration:
|
||||||
await ctx.send('**Already auto-deleting in {}.** Type `stop` to stop.'.format(ctx.channel.mention), delete_after=7)
|
await ctx.send('**Already auto-deleting in {}.** Type `stop` to stop.'.format(ctx.channel.mention), delete_after=7)
|
||||||
await ctx.message.add_reaction('\N{CROSS MARK}')
|
await ctx.message.add_reaction('\N{CROSS MARK}')
|
||||||
|
|
||||||
@commands.command(name='deletecommands', aliases=['delcmds'])
|
@commands.group(aliases=['setting', 'set', 's'])
|
||||||
@commands.has_permissions(administrator=True)
|
@commands.has_permissions(administrator=True)
|
||||||
async def delete_commands(self, ctx):
|
async def settings(self, ctx):
|
||||||
|
pass
|
||||||
|
|
||||||
|
@settings.command(name='deletecommands', aliases=['delcmds', 'delcmd'])
|
||||||
|
async def _settings_delete_commands(self, ctx):
|
||||||
if ctx.guild.id not in u.settings['del_ctx']:
|
if ctx.guild.id not in u.settings['del_ctx']:
|
||||||
u.settings['del_ctx'].append(ctx.guild.id)
|
u.settings['del_ctx'].append(ctx.guild.id)
|
||||||
else:
|
else:
|
||||||
|
@ -177,13 +188,12 @@ class Administration:
|
||||||
|
|
||||||
await ctx.send('**Delete command invocations:** `{}`'.format(ctx.guild.id in u.settings['del_ctx']))
|
await ctx.send('**Delete command invocations:** `{}`'.format(ctx.guild.id in u.settings['del_ctx']))
|
||||||
|
|
||||||
@commands.command(name='setprefix', aliases=['setpre', 'spre'])
|
@settings.command(name='prefix', aliases=['pre', 'p'])
|
||||||
@commands.has_permissions(administrator=True)
|
async def _settings_prefix(self, ctx, *prefixes):
|
||||||
async def set_prefix(self, ctx, prefix=None):
|
if prefixes:
|
||||||
if prefix is not None:
|
u.settings['prefixes'][ctx.guild.id] = prefixes
|
||||||
u.settings['prefixes'][ctx.guild.id] = prefix
|
|
||||||
else:
|
else:
|
||||||
with suppress(KeyError):
|
with suppress(KeyError):
|
||||||
del u.settings['prefixes'][ctx.guild.id]
|
del u.settings['prefixes'][ctx.guild.id]
|
||||||
|
|
||||||
await ctx.send(f'**Prefix set to:** `{"` or `".join(prefix if ctx.guild.id in u.settings["prefixes"] else u.config["prefix"])}`')
|
await ctx.send(f'**Prefix set to:** `{"` or `".join(prefixes if ctx.guild.id in u.settings["prefixes"] else u.config["prefix"])}`')
|
||||||
|
|
|
@ -24,7 +24,6 @@ class Bot:
|
||||||
# Close connection to Discord - immediate offline
|
# Close connection to Discord - immediate offline
|
||||||
@commands.command(name=',die', aliases=[',d'], brief='Kills the bot', description='BOT OWNER ONLY\nCloses the connection to Discord', hidden=True)
|
@commands.command(name=',die', aliases=[',d'], brief='Kills the bot', description='BOT OWNER ONLY\nCloses the connection to Discord', hidden=True)
|
||||||
@commands.is_owner()
|
@commands.is_owner()
|
||||||
@checks.del_ctx()
|
|
||||||
async def die(self, ctx):
|
async def die(self, ctx):
|
||||||
await ctx.message.add_reaction('\N{CRESCENT MOON}')
|
await ctx.message.add_reaction('\N{CRESCENT MOON}')
|
||||||
|
|
||||||
|
@ -44,7 +43,6 @@ class Bot:
|
||||||
|
|
||||||
@commands.command(name=',restart', aliases=[',res', ',r'], hidden=True)
|
@commands.command(name=',restart', aliases=[',res', ',r'], hidden=True)
|
||||||
@commands.is_owner()
|
@commands.is_owner()
|
||||||
@checks.del_ctx()
|
|
||||||
async def restart(self, ctx):
|
async def restart(self, ctx):
|
||||||
await ctx.message.add_reaction('\N{SLEEPING SYMBOL}')
|
await ctx.message.add_reaction('\N{SLEEPING SYMBOL}')
|
||||||
|
|
||||||
|
@ -66,7 +64,6 @@ class Bot:
|
||||||
# Invite bot to bot owner's server
|
# Invite bot to bot owner's server
|
||||||
@commands.command(name=',invite', aliases=[',inv', ',link'], brief='Invite the bot', description='BOT OWNER ONLY\nInvite the bot to a server (Requires admin)', hidden=True)
|
@commands.command(name=',invite', aliases=[',inv', ',link'], brief='Invite the bot', description='BOT OWNER ONLY\nInvite the bot to a server (Requires admin)', hidden=True)
|
||||||
@commands.is_owner()
|
@commands.is_owner()
|
||||||
@checks.del_ctx()
|
|
||||||
async def invite(self, ctx):
|
async def invite(self, ctx):
|
||||||
await ctx.message.add_reaction('\N{ENVELOPE}')
|
await ctx.message.add_reaction('\N{ENVELOPE}')
|
||||||
|
|
||||||
|
@ -74,16 +71,27 @@ class Bot:
|
||||||
|
|
||||||
@commands.command(name=',status', aliases=[',presence', ',game'], hidden=True)
|
@commands.command(name=',status', aliases=[',presence', ',game'], hidden=True)
|
||||||
@commands.is_owner()
|
@commands.is_owner()
|
||||||
@checks.del_ctx()
|
async def change_status(self, ctx, *, game=None):
|
||||||
async def status(self, ctx, *, game=None):
|
if game:
|
||||||
if game is not None:
|
|
||||||
await self.bot.change_presence(game=d.Game(name=game))
|
await self.bot.change_presence(game=d.Game(name=game))
|
||||||
u.config['playing'] = game
|
u.config['playing'] = game
|
||||||
u.dump(u.config, 'config.json', json=True)
|
u.dump(u.config, 'config.json', json=True)
|
||||||
|
await ctx.send(f'**Game changed to** `{game}`')
|
||||||
else:
|
else:
|
||||||
await self.bot.change_presence(game=None)
|
await self.bot.change_presence(game=None)
|
||||||
u.config['playing'] = 'None'
|
u.config['playing'] = 'None'
|
||||||
u.dump(u.config, 'config.json', json=True)
|
u.dump(u.config, 'config.json', json=True)
|
||||||
|
await ctx.send('**Game changed to** ` `')
|
||||||
|
|
||||||
|
@commands.command(name=',username', aliases=[',user'], hidden=True)
|
||||||
|
@commands.is_owner()
|
||||||
|
async def change_username(self, ctx, *, username=None):
|
||||||
|
if username:
|
||||||
|
await self.bot.edit(username=username)
|
||||||
|
await ctx.send(f'**Username changed to** `{username}`')
|
||||||
|
else:
|
||||||
|
await ctx.send('**Invalid string**', delete_after=7)
|
||||||
|
await ctx.message.add_reaction('\N{CROSS MARK}')
|
||||||
|
|
||||||
|
|
||||||
class Tools:
|
class Tools:
|
||||||
|
@ -115,7 +123,6 @@ class Tools:
|
||||||
|
|
||||||
@commands.command(name=',console', aliases=[',con', ',c'], hidden=True)
|
@commands.command(name=',console', aliases=[',con', ',c'], hidden=True)
|
||||||
@commands.is_owner()
|
@commands.is_owner()
|
||||||
@checks.del_ctx()
|
|
||||||
async def console(self, ctx):
|
async def console(self, ctx):
|
||||||
def execute(msg):
|
def execute(msg):
|
||||||
if msg.content.lower().startswith('exec ') and msg.author is ctx.author and msg.channel is ctx.channel:
|
if msg.content.lower().startswith('exec ') and msg.author is ctx.author and msg.channel is ctx.channel:
|
||||||
|
@ -189,7 +196,6 @@ class Tools:
|
||||||
|
|
||||||
@commands.command(name=',execute', aliases=[',exec'], hidden=True)
|
@commands.command(name=',execute', aliases=[',exec'], hidden=True)
|
||||||
@commands.is_owner()
|
@commands.is_owner()
|
||||||
@checks.del_ctx()
|
|
||||||
async def execute(self, ctx, *, exe):
|
async def execute(self, ctx, *, exe):
|
||||||
try:
|
try:
|
||||||
with io.StringIO() as buff, redirect_stdout(buff):
|
with io.StringIO() as buff, redirect_stdout(buff):
|
||||||
|
@ -201,7 +207,6 @@ class Tools:
|
||||||
|
|
||||||
@commands.command(name=',evaluate', aliases=[',eval'], hidden=True)
|
@commands.command(name=',evaluate', aliases=[',eval'], hidden=True)
|
||||||
@commands.is_owner()
|
@commands.is_owner()
|
||||||
@checks.del_ctx()
|
|
||||||
async def evaluate(self, ctx, *, evl):
|
async def evaluate(self, ctx, *, evl):
|
||||||
try:
|
try:
|
||||||
with io.StringIO() as buff, redirect_stdout(buff):
|
with io.StringIO() as buff, redirect_stdout(buff):
|
||||||
|
@ -213,7 +218,6 @@ class Tools:
|
||||||
|
|
||||||
@commands.group(aliases=[',db'], hidden=True)
|
@commands.group(aliases=[',db'], hidden=True)
|
||||||
@commands.is_owner()
|
@commands.is_owner()
|
||||||
@checks.del_ctx()
|
|
||||||
async def debug(self, ctx):
|
async def debug(self, ctx):
|
||||||
console = await self.generate(ctx)
|
console = await self.generate(ctx)
|
||||||
|
|
||||||
|
|
|
@ -47,19 +47,16 @@ class Utils:
|
||||||
|
|
||||||
# Displays latency
|
# Displays latency
|
||||||
@commands.command(aliases=['p'], brief='Pong!', description='Returns latency from bot to Discord servers, not to user')
|
@commands.command(aliases=['p'], brief='Pong!', description='Returns latency from bot to Discord servers, not to user')
|
||||||
@checks.del_ctx()
|
|
||||||
async def ping(self, ctx):
|
async def ping(self, ctx):
|
||||||
await ctx.message.add_reaction('\N{TABLE TENNIS PADDLE AND BALL}')
|
await ctx.message.add_reaction('\N{TABLE TENNIS PADDLE AND BALL}')
|
||||||
await ctx.send(ctx.author.mention + ' \N{TABLE TENNIS PADDLE AND BALL} `' + str(round(self.bot.latency * 1000)) + 'ms`', delete_after=5)
|
await ctx.send(ctx.author.mention + ' \N{TABLE TENNIS PADDLE AND BALL} `' + str(round(self.bot.latency * 1000)) + 'ms`', delete_after=5)
|
||||||
|
|
||||||
@commands.command(aliases=['pre'], brief='List bot prefixes', description='Shows all used prefixes')
|
@commands.command(aliases=['pre'], brief='List bot prefixes', description='Shows all used prefixes')
|
||||||
@checks.del_ctx()
|
|
||||||
async def prefix(self, ctx):
|
async def prefix(self, ctx):
|
||||||
await ctx.send('**Prefix:** `{}`'.format('` or `'.join(u.settings['prefixes'][ctx.guild.id] if ctx.guild.id in u.settings['prefixes'] else u.config['prefix'])))
|
await ctx.send('**Prefix:** `{}`'.format('` or `'.join(u.settings['prefixes'][ctx.guild.id] if ctx.guild.id in u.settings['prefixes'] else u.config['prefix'])))
|
||||||
|
|
||||||
@commands.group(name=',send', aliases=[',s'], hidden=True)
|
@commands.group(name=',send', aliases=[',s'], hidden=True)
|
||||||
@commands.is_owner()
|
@commands.is_owner()
|
||||||
@checks.del_ctx()
|
|
||||||
async def send(self, ctx):
|
async def send(self, ctx):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
@ -84,7 +81,7 @@ class Utils:
|
||||||
async def send_user(self, ctx, user, *, message):
|
async def send_user(self, ctx, user, *, message):
|
||||||
await d.utils.get(self.bot.get_all_members(), id=int(user)).send(message)
|
await d.utils.get(self.bot.get_all_members(), id=int(user)).send(message)
|
||||||
|
|
||||||
@commands.command(aliases=['authenticateupload', 'authupload', 'authup', 'auth'])
|
@commands.command(aliases=['authenticateupload', 'authupload', 'authup', 'auth'], hidden=True)
|
||||||
async def authenticate_upload(self, ctx):
|
async def authenticate_upload(self, ctx):
|
||||||
global youtube
|
global youtube
|
||||||
flow = flow_from_clientsecrets('client_secrets.json', scope='https://www.googleapis.com/auth/youtube.upload',
|
flow = flow_from_clientsecrets('client_secrets.json', scope='https://www.googleapis.com/auth/youtube.upload',
|
||||||
|
@ -95,7 +92,7 @@ class Utils:
|
||||||
youtube = build('youtube', 'v3', http=credentials.authorize(http.build_http()))
|
youtube = build('youtube', 'v3', http=credentials.authorize(http.build_http()))
|
||||||
print('Service built.')
|
print('Service built.')
|
||||||
|
|
||||||
@commands.command(aliases=['up', 'u', 'vid', 'v'])
|
@commands.command(aliases=['up', 'u', 'vid', 'v'], hidden=True)
|
||||||
@commands.has_permissions(administrator=True)
|
@commands.has_permissions(administrator=True)
|
||||||
async def upload(self, ctx):
|
async def upload(self, ctx):
|
||||||
global youtube
|
global youtube
|
||||||
|
|
|
@ -49,13 +49,3 @@ def is_nsfw():
|
||||||
return ctx.message.channel.is_nsfw()
|
return ctx.message.channel.is_nsfw()
|
||||||
return True
|
return True
|
||||||
return commands.check(predicate)
|
return commands.check(predicate)
|
||||||
|
|
||||||
|
|
||||||
def del_ctx():
|
|
||||||
async def predicate(ctx):
|
|
||||||
with suppress(AttributeError):
|
|
||||||
if ctx.guild.id in u.settings['del_ctx'] and ctx.me.permissions_in(ctx.channel).manage_messages and isinstance(ctx.message.channel, d.TextChannel):
|
|
||||||
with suppress(err.NotFound):
|
|
||||||
await ctx.message.delete()
|
|
||||||
return True
|
|
||||||
return commands.check(predicate)
|
|
||||||
|
|
|
@ -23,19 +23,44 @@ from utils import utils as u
|
||||||
log.basicConfig(level=log.WARNING)
|
log.basicConfig(level=log.WARNING)
|
||||||
|
|
||||||
|
|
||||||
class HelpFormatter(commands.HelpFormatter):
|
# class HelpFormatter(commands.HelpFormatter):
|
||||||
async def format():
|
#
|
||||||
pass
|
# async def format(self):
|
||||||
|
# self._paginator = commands.Paginator()
|
||||||
|
#
|
||||||
|
# # we need a padding of ~80 or so
|
||||||
|
#
|
||||||
|
# description = self.command.description if not self.is_cog() else inspect.getdoc(self.command)
|
||||||
|
#
|
||||||
|
# if description:
|
||||||
|
# # <description> portion
|
||||||
|
# self._paginator.add_line(description, empty=True)
|
||||||
|
#
|
||||||
|
# if isinstance(self.command, commands.Command):
|
||||||
|
# # <signature portion>
|
||||||
|
# signature = self.get_command_signature()
|
||||||
|
# self._paginator.add_line(signature, empty=True)
|
||||||
|
#
|
||||||
|
# # <long doc> section
|
||||||
|
# if self.command.help:
|
||||||
|
# self._paginator.add_line(self.command.help, empty=True)
|
||||||
|
#
|
||||||
|
# # end it here if it's just a regular command
|
||||||
|
# if not self.has_subcommands():
|
||||||
|
# self._paginator.close_page()
|
||||||
|
# return self._paginator.pages
|
||||||
|
#
|
||||||
|
# max_width = self.max_name_size
|
||||||
|
|
||||||
|
|
||||||
def get_prefix(bot, message):
|
def get_prefix(bot, message):
|
||||||
if isinstance(message.guild, d.Guild) and message.guild.id in u.settings['prefixes']:
|
return u.settings['prefixes'].get(message.guild.id, u.config['prefix'])
|
||||||
return u.settings['prefixes'][message.guild.id]
|
|
||||||
return u.config['prefix']
|
|
||||||
|
|
||||||
|
bot = commands.Bot(command_prefix=get_prefix, formatter=commands.HelpFormatter(show_check_failure=True), description='Modumind - A booru bot with a side of management\n\nS for single command\nG for group command', help_attrs={'aliases': ['h']}, pm_help=None)
|
||||||
|
|
||||||
help_formatter = HelpFormatter(show_check_failure=True)
|
@bot.command(help='help', brief='brief', description='description', usage='usage')
|
||||||
bot = commands.Bot(command_prefix=get_prefix, formatter=help_formatter, description='Experimental miscellaneous bot')
|
async def test(ctx):
|
||||||
|
pass
|
||||||
|
|
||||||
# Send and print ready message to #testing and console after logon
|
# Send and print ready message to #testing and console after logon
|
||||||
|
|
||||||
|
@ -109,7 +134,12 @@ async def on_command_error(ctx, error):
|
||||||
|
|
||||||
@bot.event
|
@bot.event
|
||||||
async def on_command_completion(ctx):
|
async def on_command_completion(ctx):
|
||||||
await ctx.message.add_reaction('\N{WHITE HEAVY CHECK MARK}')
|
with suppress(err.NotFound):
|
||||||
|
with suppress(AttributeError):
|
||||||
|
if ctx.guild.id in u.settings['del_ctx'] and ctx.me.permissions_in(ctx.channel).manage_messages and isinstance(ctx.message.channel, d.TextChannel):
|
||||||
|
await ctx.message.delete()
|
||||||
|
|
||||||
|
await ctx.message.add_reaction('\N{WHITE HEAVY CHECK MARK}')
|
||||||
|
|
||||||
if ctx.command.name != 'lastcommand':
|
if ctx.command.name != 'lastcommand':
|
||||||
u.last_commands[ctx.author.id] = ctx
|
u.last_commands[ctx.author.id] = ctx
|
||||||
|
@ -141,7 +171,6 @@ def after(voice, error):
|
||||||
# suggested = u.setdefault('cogs/suggested.pkl', {'last_update': 'None', 'tags': {}, 'total': 0})
|
# suggested = u.setdefault('cogs/suggested.pkl', {'last_update': 'None', 'tags': {}, 'total': 0})
|
||||||
@bot.command(name=',test', hidden=True)
|
@bot.command(name=',test', hidden=True)
|
||||||
@commands.is_owner()
|
@commands.is_owner()
|
||||||
@checks.del_ctx()
|
|
||||||
async def test(ctx):
|
async def test(ctx):
|
||||||
post = await u.fetch('https://e621.net/post/show.json?id=1145042', json=True)
|
post = await u.fetch('https://e621.net/post/show.json?id=1145042', json=True)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue