mirror of
https://github.com/myned/modufur.git
synced 2024-12-25 06:37:29 +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:
|
if tag is None:
|
||||||
raise exc.MissingArgument
|
raise exc.MissingArgument
|
||||||
|
|
||||||
|
await ctx.message.add_reaction('✅')
|
||||||
await ctx.trigger_typing()
|
await ctx.trigger_typing()
|
||||||
|
|
||||||
tag_request = await u.fetch('https://e621.net/tag/related.json', params={'tags': tag, 'type': 'general'}, json=True)
|
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:
|
if tag is None:
|
||||||
raise exc.MissingArgument
|
raise exc.MissingArgument
|
||||||
|
|
||||||
|
await ctx.message.add_reaction('✅')
|
||||||
await ctx.trigger_typing()
|
await ctx.trigger_typing()
|
||||||
|
|
||||||
alias_request = await u.fetch('https://e621.net/tag_alias/index.json', params={'aliased_to': tag, 'approved': 'true'}, json=True)
|
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:
|
if not urls:
|
||||||
raise exc.MissingArgument
|
raise exc.MissingArgument
|
||||||
|
|
||||||
|
await ctx.message.add_reaction('✅')
|
||||||
|
|
||||||
for url in urls:
|
for url in urls:
|
||||||
try:
|
try:
|
||||||
await ctx.trigger_typing()
|
await ctx.trigger_typing()
|
||||||
|
@ -108,6 +112,8 @@ class MsG:
|
||||||
if not urls and not ctx.message.attachments:
|
if not urls and not ctx.message.attachments:
|
||||||
raise exc.MissingArgument
|
raise exc.MissingArgument
|
||||||
|
|
||||||
|
await ctx.message.add_reaction('✅')
|
||||||
|
|
||||||
for url in urls:
|
for url in urls:
|
||||||
try:
|
try:
|
||||||
await ctx.trigger_typing()
|
await ctx.trigger_typing()
|
||||||
|
@ -135,13 +141,15 @@ class MsG:
|
||||||
|
|
||||||
@commands.command(name='reverseall', aliases=['revall', 'risall', 'rall'])
|
@commands.command(name='reverseall', aliases=['revall', 'risall', 'rall'])
|
||||||
@checks.del_ctx()
|
@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):
|
async def reverse_image_search_all(self, ctx, arg=None, limit=1):
|
||||||
urls = []
|
urls = []
|
||||||
attachments = []
|
attachments = []
|
||||||
delete = False
|
delete = False
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
await ctx.message.add_reaction('✅')
|
||||||
|
|
||||||
if arg == '-d' or arg == '-del' or arg == '-delete':
|
if arg == '-d' or arg == '-del' or arg == '-delete':
|
||||||
delete = True
|
delete = True
|
||||||
elif arg is not None:
|
elif arg is not None:
|
||||||
|
@ -150,8 +158,10 @@ class MsG:
|
||||||
async for message in ctx.channel.history(limit=limit + 1):
|
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:
|
if re.search('(http[a-z]?:\/\/[^ ]*\.(?:gif|png|jpg|jpeg))', message.content) is not None:
|
||||||
urls.append(message)
|
urls.append(message)
|
||||||
|
await message.add_reaction('⌛️')
|
||||||
elif message.attachments:
|
elif message.attachments:
|
||||||
attachments.append(message)
|
attachments.append(message)
|
||||||
|
await message.add_reaction('⌛️')
|
||||||
|
|
||||||
if not urls and not attachments:
|
if not urls and not attachments:
|
||||||
raise exc.NotFound
|
raise exc.NotFound
|
||||||
|
@ -200,6 +210,8 @@ class MsG:
|
||||||
if not urls and not ctx.message.attachments:
|
if not urls and not ctx.message.attachments:
|
||||||
raise exc.MissingArgument
|
raise exc.MissingArgument
|
||||||
|
|
||||||
|
await ctx.message.add_reaction('✅')
|
||||||
|
|
||||||
for url in urls:
|
for url in urls:
|
||||||
try:
|
try:
|
||||||
await ctx.trigger_typing()
|
await ctx.trigger_typing()
|
||||||
|
@ -231,12 +243,14 @@ class MsG:
|
||||||
|
|
||||||
@commands.command(name='qualityall', aliases=['qrevall', 'qisall', 'qall'])
|
@commands.command(name='qualityall', aliases=['qrevall', 'qisall', 'qall'])
|
||||||
@checks.del_ctx()
|
@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):
|
async def quality_reverse_image_search_all(self, ctx, arg=None, limit=1):
|
||||||
urls = []
|
urls = []
|
||||||
attachments = []
|
attachments = []
|
||||||
delete = False
|
delete = False
|
||||||
|
|
||||||
|
await ctx.message.add_reaction('✅')
|
||||||
|
|
||||||
try:
|
try:
|
||||||
if arg == '-d' or arg == '-del' or arg == '-delete':
|
if arg == '-d' or arg == '-del' or arg == '-delete':
|
||||||
delete = True
|
delete = True
|
||||||
|
@ -246,8 +260,10 @@ class MsG:
|
||||||
async for message in ctx.channel.history(limit=limit + 1):
|
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:
|
if re.search('(http[a-z]?:\/\/[^ ]*\.(?:gif|png|jpg|jpeg))', message.content) is not None:
|
||||||
urls.append(message)
|
urls.append(message)
|
||||||
|
await message.add_reaction('⌛️')
|
||||||
elif message.attachments:
|
elif message.attachments:
|
||||||
attachments.append(message)
|
attachments.append(message)
|
||||||
|
await message.add_reaction('⌛️')
|
||||||
|
|
||||||
if not urls and not attachments:
|
if not urls and not attachments:
|
||||||
raise exc.NotFound
|
raise exc.NotFound
|
||||||
|
@ -343,6 +359,7 @@ class MsG:
|
||||||
while not self.bot.is_closed():
|
while not self.bot.is_closed():
|
||||||
message = await self.bot.wait_for('message', check=check)
|
message = await self.bot.wait_for('message', check=check)
|
||||||
await self.queue.put(message)
|
await self.queue.put(message)
|
||||||
|
await message.add_reaction('⌛️')
|
||||||
|
|
||||||
except exc.Abort:
|
except exc.Abort:
|
||||||
u.tasks['auto_rev'].remove(channel.id)
|
u.tasks['auto_rev'].remove(channel.id)
|
||||||
|
@ -355,6 +372,8 @@ class MsG:
|
||||||
@commands.command(name='autoreverse', aliases=['autorev', 'ar'])
|
@commands.command(name='autoreverse', aliases=['autorev', 'ar'])
|
||||||
async def auto_reverse_image_search(self, ctx):
|
async def auto_reverse_image_search(self, ctx):
|
||||||
try:
|
try:
|
||||||
|
await ctx.message.add_reaction('✅')
|
||||||
|
|
||||||
if ctx.channel.id not in u.tasks['auto_rev']:
|
if ctx.channel.id not in u.tasks['auto_rev']:
|
||||||
u.tasks['auto_rev'].append(ctx.channel.id)
|
u.tasks['auto_rev'].append(ctx.channel.id)
|
||||||
u.dump(u.tasks, 'cogs/tasks.pkl')
|
u.dump(u.tasks, 'cogs/tasks.pkl')
|
||||||
|
@ -449,6 +468,7 @@ class MsG:
|
||||||
c = 1
|
c = 1
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
await ctx.message.add_reaction('✅')
|
||||||
await ctx.trigger_typing()
|
await ctx.trigger_typing()
|
||||||
|
|
||||||
pool, posts = await self.return_pool(ctx=ctx, booru='e621', query=kwords)
|
pool, posts = await self.return_pool(ctx=ctx, booru='e621', query=kwords)
|
||||||
|
@ -626,6 +646,7 @@ class MsG:
|
||||||
try:
|
try:
|
||||||
args = self.get_favorites(ctx, args)
|
args = self.get_favorites(ctx, args)
|
||||||
|
|
||||||
|
await ctx.message.add_reaction('✅')
|
||||||
await ctx.trigger_typing()
|
await ctx.trigger_typing()
|
||||||
|
|
||||||
posts = await self.check_return_posts(ctx=ctx, booru='e621', tags=args, limit=limit)
|
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)
|
args = self.get_favorites(ctx, args)
|
||||||
limit = self.get_limit(args)
|
limit = self.get_limit(args)
|
||||||
|
|
||||||
|
await ctx.message.add_reaction('✅')
|
||||||
await ctx.trigger_typing()
|
await ctx.trigger_typing()
|
||||||
|
|
||||||
posts = await self.check_return_posts(ctx=ctx, booru='e621', tags=args, limit=limit)
|
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)
|
args = self.get_favorites(ctx, args)
|
||||||
limit = self.get_limit(args)
|
limit = self.get_limit(args)
|
||||||
|
|
||||||
|
await ctx.message.add_reaction('✅')
|
||||||
await ctx.trigger_typing()
|
await ctx.trigger_typing()
|
||||||
|
|
||||||
posts = await self.check_return_posts(ctx=ctx, booru='e926', tags=args, limit=limit)
|
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):
|
async def favorite(self, ctx):
|
||||||
if ctx.invoked_subcommand is None:
|
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)
|
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
|
@favorite.error
|
||||||
async def favorite_error(self, ctx, error):
|
async def favorite_error(self, ctx, error):
|
||||||
|
@ -924,6 +949,8 @@ class MsG:
|
||||||
async def blacklist(self, ctx):
|
async def blacklist(self, ctx):
|
||||||
if ctx.invoked_subcommand is None:
|
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)
|
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
|
# @blacklist.error
|
||||||
# async def blacklist_error(self, ctx, error):
|
# async def blacklist_error(self, ctx, error):
|
||||||
|
|
|
@ -50,6 +50,8 @@ class Administration:
|
||||||
|
|
||||||
history = []
|
history = []
|
||||||
try:
|
try:
|
||||||
|
await ctx.message.add_reaction('✅')
|
||||||
|
|
||||||
pru_sent = await ctx.send('⌛️ **Pruning** <@{}>**\'s messages will take some time.**'.format(uid))
|
pru_sent = await ctx.send('⌛️ **Pruning** <@{}>**\'s messages will take some time.**'.format(uid))
|
||||||
ch_sent = await ctx.send('🗄 **Caching channels...**')
|
ch_sent = await ctx.send('🗄 **Caching channels...**')
|
||||||
|
|
||||||
|
@ -138,6 +140,8 @@ class Administration:
|
||||||
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']:
|
||||||
|
await ctx.message.add_reaction('✅')
|
||||||
|
|
||||||
u.tasks['auto_del'].append(ctx.channel.id)
|
u.tasks['auto_del'].append(ctx.channel.id)
|
||||||
u.dump(u.tasks, 'cogs/tasks.pkl')
|
u.dump(u.tasks, 'cogs/tasks.pkl')
|
||||||
self.bot.loop.create_task(self.queue_on_message(ctx.channel))
|
self.bot.loop.create_task(self.queue_on_message(ctx.channel))
|
||||||
|
|
|
@ -27,6 +27,8 @@ class Bot:
|
||||||
@commands.is_owner()
|
@commands.is_owner()
|
||||||
@checks.del_ctx()
|
@checks.del_ctx()
|
||||||
async def die(self, ctx):
|
async def die(self, ctx):
|
||||||
|
await ctx.message.add_reaction('🌙')
|
||||||
|
|
||||||
if isinstance(self.bot.get_channel(u.config['shutdown_channel']), d.TextChannel):
|
if isinstance(self.bot.get_channel(u.config['shutdown_channel']), d.TextChannel):
|
||||||
await self.bot.get_channel(u.config['shutdown_channel']).send('**Shutting down** 🌙 . . .')
|
await self.bot.get_channel(u.config['shutdown_channel']).send('**Shutting down** 🌙 . . .')
|
||||||
# loop = self.bot.loop.all_tasks()
|
# loop = self.bot.loop.all_tasks()
|
||||||
|
@ -41,6 +43,8 @@ class Bot:
|
||||||
@commands.is_owner()
|
@commands.is_owner()
|
||||||
@checks.del_ctx()
|
@checks.del_ctx()
|
||||||
async def restart(self, 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')
|
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):
|
if isinstance(self.bot.get_channel(u.config['shutdown_channel']), d.TextChannel):
|
||||||
await self.bot.get_channel(u.config['shutdown_channel']).send('**Restarting** 💤 . . .')
|
await self.bot.get_channel(u.config['shutdown_channel']).send('**Restarting** 💤 . . .')
|
||||||
|
@ -57,12 +61,16 @@ class Bot:
|
||||||
@commands.is_owner()
|
@commands.is_owner()
|
||||||
@checks.del_ctx()
|
@checks.del_ctx()
|
||||||
async def invite(self, 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)
|
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.command(name=',status', aliases=[',presence', ',game'], hidden=True)
|
||||||
@commands.is_owner()
|
@commands.is_owner()
|
||||||
@checks.del_ctx()
|
@checks.del_ctx()
|
||||||
async def status(self, ctx, *, game=None):
|
async def status(self, ctx, *, game=None):
|
||||||
|
await ctx.message.add_reaction('✅')
|
||||||
|
|
||||||
if game is not None:
|
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
|
||||||
|
@ -72,8 +80,6 @@ class Bot:
|
||||||
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.message.add_reaction('✅')
|
|
||||||
|
|
||||||
|
|
||||||
class Tools:
|
class Tools:
|
||||||
|
|
||||||
|
@ -116,6 +122,8 @@ class Tools:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
await ctx.message.add_reaction('✅')
|
||||||
|
|
||||||
console = await self.generate(ctx)
|
console = await self.generate(ctx)
|
||||||
exception = await self.generate_err(ctx)
|
exception = await self.generate_err(ctx)
|
||||||
while not self.bot.is_closed():
|
while not self.bot.is_closed():
|
||||||
|
@ -147,6 +155,8 @@ class Tools:
|
||||||
@checks.del_ctx()
|
@checks.del_ctx()
|
||||||
async def arbitrary(self, ctx, *, exe):
|
async def arbitrary(self, ctx, *, exe):
|
||||||
try:
|
try:
|
||||||
|
await ctx.message.add_reaction('✅')
|
||||||
|
|
||||||
sys.stdout = io.StringIO()
|
sys.stdout = io.StringIO()
|
||||||
exec(exe)
|
exec(exe)
|
||||||
await self.generate(ctx, exe, sys.stdout.getvalue())
|
await self.generate(ctx, exe, sys.stdout.getvalue())
|
||||||
|
|
|
@ -48,19 +48,23 @@ class Utils:
|
||||||
async def ping(self, ctx):
|
async def ping(self, ctx):
|
||||||
global command_dict
|
global command_dict
|
||||||
|
|
||||||
|
await ctx.message.add_reaction('🏓')
|
||||||
|
|
||||||
await ctx.send(ctx.author.mention + ' 🏓 `' + str(round(self.bot.latency * 1000)) + 'ms`', delete_after=5)
|
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})
|
command_dict.setdefault(str(ctx.author.id), {}).update({'command': ctx.command})
|
||||||
|
|
||||||
@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()
|
@checks.del_ctx()
|
||||||
async def prefix(self, ctx):
|
async def prefix(self, ctx):
|
||||||
|
await ctx.message.add_reaction('✅')
|
||||||
|
|
||||||
await ctx.send('**Prefix:** `{}`'.format(u.config['prefix']))
|
await ctx.send('**Prefix:** `{}`'.format(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()
|
@checks.del_ctx()
|
||||||
async def send(self, ctx):
|
async def send(self, ctx):
|
||||||
pass
|
await ctx.message.add_reaction('✅')
|
||||||
|
|
||||||
@send.command(name='guild', aliases=['g', 'server', 's'])
|
@send.command(name='guild', aliases=['g', 'server', 's'])
|
||||||
async def send_guild(self, ctx, guild, channel, *message):
|
async def send_guild(self, ctx, guild, channel, *message):
|
||||||
|
|
Loading…
Reference in a new issue