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
50a54ba944
5 changed files with 38 additions and 18 deletions
|
@ -175,7 +175,7 @@ class MsG:
|
|||
embed.set_author(name=pool['name'],
|
||||
url='https://e621.net/pool/show?id={}'.format(pool['id']), icon_url=user.avatar_url)
|
||||
embed.set_footer(text='{} / {}'.format(c, len(posts)),
|
||||
icon_url='http://ndl.mgccw.com/mu3/app/20141013/18/1413204353554/icon/icon_xl.png')
|
||||
icon_url='icon_e6.png')
|
||||
|
||||
paginator = await ctx.send(embed=embed)
|
||||
|
||||
|
@ -196,7 +196,7 @@ class MsG:
|
|||
embed.title = values[c - 1]['author']
|
||||
embed.url = 'https://e621.net/post/show/{}'.format(keys[c - 1])
|
||||
embed.set_footer(text='{} / {}'.format(c, len(posts)),
|
||||
icon_url='http://ndl.mgccw.com/mu3/app/20141013/18/1413204353554/icon/icon_xl.png')
|
||||
icon_url='icon_e6.png')
|
||||
embed.set_image(url=values[c - 1]['url'])
|
||||
|
||||
await paginator.edit(content=None, embed=embed)
|
||||
|
@ -212,7 +212,7 @@ class MsG:
|
|||
embed.title = values[c - 1]['author']
|
||||
embed.url = 'https://e621.net/post/show/{}'.format(keys[c - 1])
|
||||
embed.set_footer(text='{} / {}'.format(c, len(posts)),
|
||||
icon_url='http://ndl.mgccw.com/mu3/app/20141013/18/1413204353554/icon/icon_xl.png')
|
||||
icon_url='icon_e6.png')
|
||||
embed.set_image(url=values[c - 1]['url'])
|
||||
|
||||
await paginator.edit(content=None, embed=embed)
|
||||
|
@ -229,7 +229,7 @@ class MsG:
|
|||
embed.title = values[c - 1]['author']
|
||||
embed.url = 'https://e621.net/post/show/{}'.format(keys[c - 1])
|
||||
embed.set_footer(text='{} / {}'.format(c, len(posts)),
|
||||
icon_url='http://ndl.mgccw.com/mu3/app/20141013/18/1413204353554/icon/icon_xl.png')
|
||||
icon_url='icon_e6.png')
|
||||
embed.set_image(url=values[c - 1]['url'])
|
||||
|
||||
await paginator.edit(content=None, embed=embed)
|
||||
|
@ -360,7 +360,7 @@ class MsG:
|
|||
embed.set_author(name=formatter.tostring(args, random=True),
|
||||
url='https://e621.net/post?tags={}'.format(','.join(args)), icon_url=user.avatar_url)
|
||||
embed.set_footer(text='{} / {}'.format(c, len(posts)),
|
||||
icon_url='http://ndl.mgccw.com/mu3/app/20141013/18/1413204353554/icon/icon_xl.png')
|
||||
icon_url='icon_e6.png')
|
||||
|
||||
paginator = await ctx.send(embed=embed)
|
||||
|
||||
|
@ -381,7 +381,7 @@ class MsG:
|
|||
embed.title = values[c - 1]['author']
|
||||
embed.url = 'https://e621.net/post/show/{}'.format(keys[c - 1])
|
||||
embed.set_footer(text='{} / {}'.format(c, len(posts)),
|
||||
icon_url='http://ndl.mgccw.com/mu3/app/20141013/18/1413204353554/icon/icon_xl.png')
|
||||
icon_url='icon_e6.png')
|
||||
embed.set_image(url=values[c - 1]['url'])
|
||||
await paginator.edit(content=None, embed=embed)
|
||||
else:
|
||||
|
@ -396,7 +396,7 @@ class MsG:
|
|||
embed.title = values[c - 1]['author']
|
||||
embed.url = 'https://e621.net/post/show/{}'.format(keys[c - 1])
|
||||
embed.set_footer(text='{} / {}'.format(c, len(posts)),
|
||||
icon_url='http://ndl.mgccw.com/mu3/app/20141013/18/1413204353554/icon/icon_xl.png')
|
||||
icon_url='icon_e6.png')
|
||||
embed.set_image(url=values[c - 1]['url'])
|
||||
|
||||
await paginator.edit(content=None, embed=embed)
|
||||
|
@ -423,7 +423,7 @@ class MsG:
|
|||
embed.title = values[c - 1]['author']
|
||||
embed.url = 'https://e621.net/post/show/{}'.format(keys[c - 1])
|
||||
embed.set_footer(text='{} / {}'.format(c, len(posts)),
|
||||
icon_url='http://ndl.mgccw.com/mu3/app/20141013/18/1413204353554/icon/icon_xl.png')
|
||||
icon_url='icon_e6.png')
|
||||
embed.set_image(url=values[c - 1]['url'])
|
||||
await paginator.edit(content=None, embed=embed)
|
||||
|
||||
|
@ -486,7 +486,7 @@ class MsG:
|
|||
embed.set_author(name=formatter.tostring(args, random=True),
|
||||
url='https://e621.net/post?tags={}'.format(','.join(args)), icon_url=user.avatar_url)
|
||||
embed.set_footer(
|
||||
text=str(ident), icon_url='http://ndl.mgccw.com/mu3/app/20141013/18/1413204353554/icon/icon_xl.png')
|
||||
text=str(ident), icon_url='icon_e6.png')
|
||||
await ctx.send(embed=embed)
|
||||
|
||||
except exc.TagBlacklisted as e:
|
||||
|
@ -541,7 +541,7 @@ class MsG:
|
|||
embed.set_author(name=formatter.tostring(args, random=True),
|
||||
url='https://e621.net/post?tags={}'.format(','.join(args)), icon_url=user.avatar_url)
|
||||
embed.set_footer(
|
||||
text=str(ident), icon_url='http://ndl.mgccw.com/mu3/app/20141013/18/1413204353554/icon/icon_xl.png')
|
||||
text=str(ident), icon_url='icon_e6.png')
|
||||
await ctx.send(embed=embed)
|
||||
|
||||
except exc.TagBlacklisted as e:
|
||||
|
|
|
@ -1,10 +1,11 @@
|
|||
import asyncio
|
||||
import traceback as tb
|
||||
|
||||
import discord
|
||||
import discord as d
|
||||
from discord.ext import commands
|
||||
|
||||
from misc import exceptions as exc
|
||||
from utils import utils as u
|
||||
|
||||
|
||||
class Info:
|
||||
|
@ -12,8 +13,17 @@ class Info:
|
|||
def __init__(self, bot):
|
||||
self.bot = bot
|
||||
|
||||
# @commands.command(name='helptest', aliases=['h'], hidden=True)
|
||||
# async def list_commands(self, ctx):
|
||||
# embed = d.Embed(title='All possible commands:', color=ctx.me.color)
|
||||
# embed.set_author(name=ctx.me.display_name, icon_url=ctx.me.avatar_url)
|
||||
# embed.add_field(
|
||||
# name='Booru', value='\n{}bl umbrella command for managing blacklists'.format(u.config['prefix']))
|
||||
#
|
||||
# await ctx.send(embed=embed)
|
||||
|
||||
@commands.command(hidden=True)
|
||||
async def hi(ctx):
|
||||
async def hi(self, ctx):
|
||||
user = ctx.author
|
||||
|
||||
hello = 'Hewwo, {}.'.format(user.mention)
|
||||
|
|
|
@ -19,7 +19,7 @@ class Administration:
|
|||
|
||||
for channel in u.tasks.get('management', {}).get('auto_delete', []):
|
||||
temp = self.bot.get_channel(channel)
|
||||
self.bot.loop.create_task(self.on_message(temp))
|
||||
self.bot.loop.create_task(self.queue_on_message(temp))
|
||||
self.bot.loop.create_task(self.delete())
|
||||
print('Looping #{}'.format(temp.name))
|
||||
|
||||
|
@ -145,7 +145,7 @@ class Administration:
|
|||
except err.NotFound:
|
||||
pass
|
||||
|
||||
async def on_message(self, channel):
|
||||
async def queue_on_message(self, channel):
|
||||
def check(msg):
|
||||
if msg.content.lower() == 'stop' and msg.channel is channel and msg.author.guild_permissions.administrator:
|
||||
raise exc.Abort
|
||||
|
@ -155,6 +155,10 @@ class Administration:
|
|||
return False
|
||||
|
||||
try:
|
||||
async for message in channel.history():
|
||||
if not msg.pinned:
|
||||
await self.queue.put(message)
|
||||
|
||||
while not self.bot.is_closed():
|
||||
message = await self.bot.wait_for('message', check=check)
|
||||
await self.queue.put(message)
|
||||
|
@ -178,7 +182,7 @@ class Administration:
|
|||
if channel.id not in u.tasks.setdefault('management', {}).setdefault('auto_delete', []):
|
||||
u.tasks['management']['auto_delete'].append(channel.id)
|
||||
u.dump(u.tasks, 'cogs/tasks.pkl')
|
||||
self.bot.loop.create_task(self.on_message(channel))
|
||||
self.bot.loop.create_task(self.queue_on_message(channel))
|
||||
self.bot.loop.create_task(self.delete())
|
||||
print('Looping #{}'.format(channel.name))
|
||||
await ctx.send('✅ **Auto-deleting all messages in this channel.**', delete_after=5)
|
||||
|
|
|
@ -3,8 +3,9 @@ import json
|
|||
import traceback
|
||||
|
||||
import discord
|
||||
from discord import errors as err
|
||||
from discord.ext import commands
|
||||
from discord.ext.commands import errors
|
||||
from discord.ext.commands import errors as errext
|
||||
|
||||
from utils import utils as u
|
||||
|
||||
|
@ -59,6 +60,11 @@ def is_nsfw():
|
|||
def del_ctx():
|
||||
async def predicate(ctx):
|
||||
if ctx.me.permissions_in(ctx.channel).manage_messages is True and isinstance(ctx.message.channel, discord.TextChannel) and ctx.guild.id in u.settings['del_ctx']:
|
||||
try:
|
||||
await ctx.message.delete()
|
||||
|
||||
except err.NotFound:
|
||||
pass
|
||||
|
||||
return True
|
||||
return commands.check(predicate)
|
||||
|
|
|
@ -43,7 +43,7 @@ async def on_ready():
|
|||
@bot.event
|
||||
async def on_error(error, *args, **kwargs):
|
||||
if isinstance(bot.get_channel(u.config['shutdown_channel']), d.TextChannel):
|
||||
await bot.get_channel(u.config['shutdown_channel']).send('**__ERROR__** ⚠️ {}\n**Exiting. . .**'.format(error))
|
||||
await bot.get_channel(u.config['shutdown_channel']).send('**ERROR** ⚠️ {}'.format(error))
|
||||
u.close()
|
||||
await bot.logout()
|
||||
await bot.close()
|
||||
|
|
Loading…
Reference in a new issue