mirror of
https://github.com/myned/modufur.git
synced 2024-11-01 13:02:38 +00:00
Merge branch 'dev'
This commit is contained in:
commit
d4af50c869
4 changed files with 50 additions and 5 deletions
|
@ -49,6 +49,7 @@ class MsG:
|
|||
if tag is None:
|
||||
raise exc.MissingArgument
|
||||
|
||||
await ctx.message.add_reaction('✅')
|
||||
await ctx.trigger_typing()
|
||||
|
||||
tag_request = await u.fetch('https://e621.net/tag/related.json', params={'tags': tag, 'type': 'general'}, json=True)
|
||||
|
@ -70,6 +71,7 @@ class MsG:
|
|||
if tag is None:
|
||||
raise exc.MissingArgument
|
||||
|
||||
await ctx.message.add_reaction('✅')
|
||||
await ctx.trigger_typing()
|
||||
|
||||
alias_request = await u.fetch('https://e621.net/tag_alias/index.json', params={'aliased_to': tag, 'approved': 'true'}, json=True)
|
||||
|
@ -88,6 +90,8 @@ class MsG:
|
|||
if not urls:
|
||||
raise exc.MissingArgument
|
||||
|
||||
await ctx.message.add_reaction('✅')
|
||||
|
||||
for url in urls:
|
||||
try:
|
||||
await ctx.trigger_typing()
|
||||
|
@ -108,6 +112,8 @@ class MsG:
|
|||
if not urls and not ctx.message.attachments:
|
||||
raise exc.MissingArgument
|
||||
|
||||
await ctx.message.add_reaction('✅')
|
||||
|
||||
for url in urls:
|
||||
try:
|
||||
await ctx.trigger_typing()
|
||||
|
@ -135,13 +141,15 @@ class MsG:
|
|||
|
||||
@commands.command(name='reverseall', aliases=['revall', 'risall', 'rall'])
|
||||
@checks.del_ctx()
|
||||
@commands.has_permissions(manage_channels=True)
|
||||
@commands.has_permissions(manage_messages=True)
|
||||
async def reverse_image_search_all(self, ctx, arg=None, limit=1):
|
||||
urls = []
|
||||
attachments = []
|
||||
delete = False
|
||||
|
||||
try:
|
||||
await ctx.message.add_reaction('✅')
|
||||
|
||||
if arg == '-d' or arg == '-del' or arg == '-delete':
|
||||
delete = True
|
||||
elif arg is not None:
|
||||
|
@ -150,8 +158,10 @@ class MsG:
|
|||
async for message in ctx.channel.history(limit=limit + 1):
|
||||
if re.search('(http[a-z]?:\/\/[^ ]*\.(?:gif|png|jpg|jpeg))', message.content) is not None:
|
||||
urls.append(message)
|
||||
await message.add_reaction('⌛️')
|
||||
elif message.attachments:
|
||||
attachments.append(message)
|
||||
await message.add_reaction('⌛️')
|
||||
|
||||
if not urls and not attachments:
|
||||
raise exc.NotFound
|
||||
|
@ -200,6 +210,8 @@ class MsG:
|
|||
if not urls and not ctx.message.attachments:
|
||||
raise exc.MissingArgument
|
||||
|
||||
await ctx.message.add_reaction('✅')
|
||||
|
||||
for url in urls:
|
||||
try:
|
||||
await ctx.trigger_typing()
|
||||
|
@ -231,12 +243,14 @@ class MsG:
|
|||
|
||||
@commands.command(name='qualityall', aliases=['qrevall', 'qisall', 'qall'])
|
||||
@checks.del_ctx()
|
||||
@commands.has_permissions(manage_channels=True)
|
||||
@commands.has_permissions(manage_messages=True)
|
||||
async def quality_reverse_image_search_all(self, ctx, arg=None, limit=1):
|
||||
urls = []
|
||||
attachments = []
|
||||
delete = False
|
||||
|
||||
await ctx.message.add_reaction('✅')
|
||||
|
||||
try:
|
||||
if arg == '-d' or arg == '-del' or arg == '-delete':
|
||||
delete = True
|
||||
|
@ -246,8 +260,10 @@ class MsG:
|
|||
async for message in ctx.channel.history(limit=limit + 1):
|
||||
if re.search('(http[a-z]?:\/\/[^ ]*\.(?:gif|png|jpg|jpeg))', message.content) is not None:
|
||||
urls.append(message)
|
||||
await message.add_reaction('⌛️')
|
||||
elif message.attachments:
|
||||
attachments.append(message)
|
||||
await message.add_reaction('⌛️')
|
||||
|
||||
if not urls and not attachments:
|
||||
raise exc.NotFound
|
||||
|
@ -343,6 +359,7 @@ class MsG:
|
|||
while not self.bot.is_closed():
|
||||
message = await self.bot.wait_for('message', check=check)
|
||||
await self.queue.put(message)
|
||||
await message.add_reaction('⌛️')
|
||||
|
||||
except exc.Abort:
|
||||
u.tasks['auto_rev'].remove(channel.id)
|
||||
|
@ -355,6 +372,8 @@ class MsG:
|
|||
@commands.command(name='autoreverse', aliases=['autorev', 'ar'])
|
||||
async def auto_reverse_image_search(self, ctx):
|
||||
try:
|
||||
await ctx.message.add_reaction('✅')
|
||||
|
||||
if ctx.channel.id not in u.tasks['auto_rev']:
|
||||
u.tasks['auto_rev'].append(ctx.channel.id)
|
||||
u.dump(u.tasks, 'cogs/tasks.pkl')
|
||||
|
@ -449,6 +468,7 @@ class MsG:
|
|||
c = 1
|
||||
|
||||
try:
|
||||
await ctx.message.add_reaction('✅')
|
||||
await ctx.trigger_typing()
|
||||
|
||||
pool, posts = await self.return_pool(ctx=ctx, booru='e621', query=kwords)
|
||||
|
@ -626,6 +646,7 @@ class MsG:
|
|||
try:
|
||||
args = self.get_favorites(ctx, args)
|
||||
|
||||
await ctx.message.add_reaction('✅')
|
||||
await ctx.trigger_typing()
|
||||
|
||||
posts = await self.check_return_posts(ctx=ctx, booru='e621', tags=args, limit=limit)
|
||||
|
@ -756,6 +777,7 @@ class MsG:
|
|||
args = self.get_favorites(ctx, args)
|
||||
limit = self.get_limit(args)
|
||||
|
||||
await ctx.message.add_reaction('✅')
|
||||
await ctx.trigger_typing()
|
||||
|
||||
posts = await self.check_return_posts(ctx=ctx, booru='e621', tags=args, limit=limit)
|
||||
|
@ -801,6 +823,7 @@ class MsG:
|
|||
args = self.get_favorites(ctx, args)
|
||||
limit = self.get_limit(args)
|
||||
|
||||
await ctx.message.add_reaction('✅')
|
||||
await ctx.trigger_typing()
|
||||
|
||||
posts = await self.check_return_posts(ctx=ctx, booru='e926', tags=args, limit=limit)
|
||||
|
@ -833,6 +856,8 @@ class MsG:
|
|||
async def favorite(self, ctx):
|
||||
if ctx.invoked_subcommand is None:
|
||||
await ctx.send('❌ **Use a flag to manage favorites.**\n*Type* `{}help fav` *for more info.*'.format(ctx.prefix), delete_after=10)
|
||||
else:
|
||||
await ctx.message.add_reaction('✅')
|
||||
|
||||
@favorite.error
|
||||
async def favorite_error(self, ctx, error):
|
||||
|
@ -924,6 +949,8 @@ class MsG:
|
|||
async def blacklist(self, ctx):
|
||||
if ctx.invoked_subcommand is None:
|
||||
await ctx.send('❌ **Use a flag to manage blacklists.**\n*Type* `{}help bl` *for more info.*'.format(ctx.prefix), delete_after=10)
|
||||
else:
|
||||
await ctx.message.add_reaction('✅')
|
||||
|
||||
# @blacklist.error
|
||||
# async def blacklist_error(self, ctx, error):
|
||||
|
|
|
@ -50,6 +50,8 @@ class Administration:
|
|||
|
||||
history = []
|
||||
try:
|
||||
await ctx.message.add_reaction('✅')
|
||||
|
||||
pru_sent = await ctx.send('⌛️ **Pruning** <@{}>**\'s messages will take some time.**'.format(uid))
|
||||
ch_sent = await ctx.send('🗄 **Caching channels...**')
|
||||
|
||||
|
@ -138,6 +140,8 @@ class Administration:
|
|||
async def auto_delete(self, ctx):
|
||||
try:
|
||||
if ctx.channel.id not in u.tasks['auto_del']:
|
||||
await ctx.message.add_reaction('✅')
|
||||
|
||||
u.tasks['auto_del'].append(ctx.channel.id)
|
||||
u.dump(u.tasks, 'cogs/tasks.pkl')
|
||||
self.bot.loop.create_task(self.queue_on_message(ctx.channel))
|
||||
|
|
|
@ -27,6 +27,8 @@ class Bot:
|
|||
@commands.is_owner()
|
||||
@checks.del_ctx()
|
||||
async def die(self, ctx):
|
||||
await ctx.message.add_reaction('🌙')
|
||||
|
||||
if isinstance(self.bot.get_channel(u.config['shutdown_channel']), d.TextChannel):
|
||||
await self.bot.get_channel(u.config['shutdown_channel']).send('**Shutting down** 🌙 . . .')
|
||||
# loop = self.bot.loop.all_tasks()
|
||||
|
@ -41,6 +43,8 @@ class Bot:
|
|||
@commands.is_owner()
|
||||
@checks.del_ctx()
|
||||
async def restart(self, ctx):
|
||||
await ctx.message.add_reaction('💤')
|
||||
|
||||
print('\n| | | | | | | | | |\nR E S T A R T I N G\n| | | | | | | | | |\n')
|
||||
if isinstance(self.bot.get_channel(u.config['shutdown_channel']), d.TextChannel):
|
||||
await self.bot.get_channel(u.config['shutdown_channel']).send('**Restarting** 💤 . . .')
|
||||
|
@ -57,12 +61,16 @@ class Bot:
|
|||
@commands.is_owner()
|
||||
@checks.del_ctx()
|
||||
async def invite(self, ctx):
|
||||
await ctx.message.add_reaction('✉️')
|
||||
|
||||
await ctx.send('🔗 https://discordapp.com/oauth2/authorize?&client_id={}&scope=bot&permissions={}'.format(u.config['client_id'], u.config['permissions']), delete_after=10)
|
||||
|
||||
@commands.command(name=',status', aliases=[',presence', ',game'], hidden=True)
|
||||
@commands.is_owner()
|
||||
@checks.del_ctx()
|
||||
async def status(self, ctx, *, game=None):
|
||||
await ctx.message.add_reaction('✅')
|
||||
|
||||
if game is not None:
|
||||
await self.bot.change_presence(game=d.Game(name=game))
|
||||
u.config['playing'] = game
|
||||
|
@ -72,8 +80,6 @@ class Bot:
|
|||
u.config['playing'] = 'None'
|
||||
u.dump(u.config, 'config.json', json=True)
|
||||
|
||||
await ctx.message.add_reaction('✅')
|
||||
|
||||
|
||||
class Tools:
|
||||
|
||||
|
@ -116,6 +122,8 @@ class Tools:
|
|||
return False
|
||||
|
||||
try:
|
||||
await ctx.message.add_reaction('✅')
|
||||
|
||||
console = await self.generate(ctx)
|
||||
exception = await self.generate_err(ctx)
|
||||
while not self.bot.is_closed():
|
||||
|
@ -147,6 +155,8 @@ class Tools:
|
|||
@checks.del_ctx()
|
||||
async def arbitrary(self, ctx, *, exe):
|
||||
try:
|
||||
await ctx.message.add_reaction('✅')
|
||||
|
||||
sys.stdout = io.StringIO()
|
||||
exec(exe)
|
||||
await self.generate(ctx, exe, sys.stdout.getvalue())
|
||||
|
|
|
@ -48,19 +48,23 @@ class Utils:
|
|||
async def ping(self, ctx):
|
||||
global command_dict
|
||||
|
||||
await ctx.message.add_reaction('🏓')
|
||||
|
||||
await ctx.send(ctx.author.mention + ' 🏓 `' + str(round(self.bot.latency * 1000)) + 'ms`', delete_after=5)
|
||||
command_dict.setdefault(str(ctx.author.id), {}).update({'command': ctx.command})
|
||||
|
||||
@commands.command(aliases=['pre'], brief='List bot prefixes', description='Shows all used prefixes')
|
||||
@checks.del_ctx()
|
||||
async def prefix(self, ctx):
|
||||
await ctx.message.add_reaction('✅')
|
||||
|
||||
await ctx.send('**Prefix:** `{}`'.format(u.config['prefix']))
|
||||
|
||||
@commands.group(name=',send', aliases=[',s'], hidden=True)
|
||||
@commands.is_owner()
|
||||
@checks.del_ctx()
|
||||
async def send(self, ctx):
|
||||
pass
|
||||
await ctx.message.add_reaction('✅')
|
||||
|
||||
@send.command(name='guild', aliases=['g', 'server', 's'])
|
||||
async def send_guild(self, ctx, guild, channel, *message):
|
||||
|
|
Loading…
Reference in a new issue