1
0
Fork 0
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:
Myned 2017-10-15 01:49:20 -04:00
commit 50a54ba944
5 changed files with 38 additions and 18 deletions

View file

@ -175,7 +175,7 @@ class MsG:
embed.set_author(name=pool['name'], embed.set_author(name=pool['name'],
url='https://e621.net/pool/show?id={}'.format(pool['id']), icon_url=user.avatar_url) url='https://e621.net/pool/show?id={}'.format(pool['id']), icon_url=user.avatar_url)
embed.set_footer(text='{} / {}'.format(c, len(posts)), 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) paginator = await ctx.send(embed=embed)
@ -196,7 +196,7 @@ class MsG:
embed.title = values[c - 1]['author'] embed.title = values[c - 1]['author']
embed.url = 'https://e621.net/post/show/{}'.format(keys[c - 1]) embed.url = 'https://e621.net/post/show/{}'.format(keys[c - 1])
embed.set_footer(text='{} / {}'.format(c, len(posts)), 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']) embed.set_image(url=values[c - 1]['url'])
await paginator.edit(content=None, embed=embed) await paginator.edit(content=None, embed=embed)
@ -212,7 +212,7 @@ class MsG:
embed.title = values[c - 1]['author'] embed.title = values[c - 1]['author']
embed.url = 'https://e621.net/post/show/{}'.format(keys[c - 1]) embed.url = 'https://e621.net/post/show/{}'.format(keys[c - 1])
embed.set_footer(text='{} / {}'.format(c, len(posts)), 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']) embed.set_image(url=values[c - 1]['url'])
await paginator.edit(content=None, embed=embed) await paginator.edit(content=None, embed=embed)
@ -229,7 +229,7 @@ class MsG:
embed.title = values[c - 1]['author'] embed.title = values[c - 1]['author']
embed.url = 'https://e621.net/post/show/{}'.format(keys[c - 1]) embed.url = 'https://e621.net/post/show/{}'.format(keys[c - 1])
embed.set_footer(text='{} / {}'.format(c, len(posts)), 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']) embed.set_image(url=values[c - 1]['url'])
await paginator.edit(content=None, embed=embed) await paginator.edit(content=None, embed=embed)
@ -360,7 +360,7 @@ class MsG:
embed.set_author(name=formatter.tostring(args, random=True), embed.set_author(name=formatter.tostring(args, random=True),
url='https://e621.net/post?tags={}'.format(','.join(args)), icon_url=user.avatar_url) url='https://e621.net/post?tags={}'.format(','.join(args)), icon_url=user.avatar_url)
embed.set_footer(text='{} / {}'.format(c, len(posts)), 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) paginator = await ctx.send(embed=embed)
@ -381,7 +381,7 @@ class MsG:
embed.title = values[c - 1]['author'] embed.title = values[c - 1]['author']
embed.url = 'https://e621.net/post/show/{}'.format(keys[c - 1]) embed.url = 'https://e621.net/post/show/{}'.format(keys[c - 1])
embed.set_footer(text='{} / {}'.format(c, len(posts)), 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']) embed.set_image(url=values[c - 1]['url'])
await paginator.edit(content=None, embed=embed) await paginator.edit(content=None, embed=embed)
else: else:
@ -396,7 +396,7 @@ class MsG:
embed.title = values[c - 1]['author'] embed.title = values[c - 1]['author']
embed.url = 'https://e621.net/post/show/{}'.format(keys[c - 1]) embed.url = 'https://e621.net/post/show/{}'.format(keys[c - 1])
embed.set_footer(text='{} / {}'.format(c, len(posts)), 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']) embed.set_image(url=values[c - 1]['url'])
await paginator.edit(content=None, embed=embed) await paginator.edit(content=None, embed=embed)
@ -423,7 +423,7 @@ class MsG:
embed.title = values[c - 1]['author'] embed.title = values[c - 1]['author']
embed.url = 'https://e621.net/post/show/{}'.format(keys[c - 1]) embed.url = 'https://e621.net/post/show/{}'.format(keys[c - 1])
embed.set_footer(text='{} / {}'.format(c, len(posts)), 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']) embed.set_image(url=values[c - 1]['url'])
await paginator.edit(content=None, embed=embed) await paginator.edit(content=None, embed=embed)
@ -486,7 +486,7 @@ class MsG:
embed.set_author(name=formatter.tostring(args, random=True), embed.set_author(name=formatter.tostring(args, random=True),
url='https://e621.net/post?tags={}'.format(','.join(args)), icon_url=user.avatar_url) url='https://e621.net/post?tags={}'.format(','.join(args)), icon_url=user.avatar_url)
embed.set_footer( 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) await ctx.send(embed=embed)
except exc.TagBlacklisted as e: except exc.TagBlacklisted as e:
@ -541,7 +541,7 @@ class MsG:
embed.set_author(name=formatter.tostring(args, random=True), embed.set_author(name=formatter.tostring(args, random=True),
url='https://e621.net/post?tags={}'.format(','.join(args)), icon_url=user.avatar_url) url='https://e621.net/post?tags={}'.format(','.join(args)), icon_url=user.avatar_url)
embed.set_footer( 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) await ctx.send(embed=embed)
except exc.TagBlacklisted as e: except exc.TagBlacklisted as e:

View file

@ -1,10 +1,11 @@
import asyncio import asyncio
import traceback as tb import traceback as tb
import discord import discord as d
from discord.ext import commands from discord.ext import commands
from misc import exceptions as exc from misc import exceptions as exc
from utils import utils as u
class Info: class Info:
@ -12,8 +13,17 @@ class Info:
def __init__(self, bot): def __init__(self, bot):
self.bot = 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) @commands.command(hidden=True)
async def hi(ctx): async def hi(self, ctx):
user = ctx.author user = ctx.author
hello = 'Hewwo, {}.'.format(user.mention) hello = 'Hewwo, {}.'.format(user.mention)

View file

@ -19,7 +19,7 @@ class Administration:
for channel in u.tasks.get('management', {}).get('auto_delete', []): for channel in u.tasks.get('management', {}).get('auto_delete', []):
temp = self.bot.get_channel(channel) 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()) self.bot.loop.create_task(self.delete())
print('Looping #{}'.format(temp.name)) print('Looping #{}'.format(temp.name))
@ -145,7 +145,7 @@ class Administration:
except err.NotFound: except err.NotFound:
pass pass
async def on_message(self, channel): async def queue_on_message(self, channel):
def check(msg): def check(msg):
if msg.content.lower() == 'stop' and msg.channel is channel and msg.author.guild_permissions.administrator: if msg.content.lower() == 'stop' and msg.channel is channel and msg.author.guild_permissions.administrator:
raise exc.Abort raise exc.Abort
@ -155,6 +155,10 @@ class Administration:
return False return False
try: try:
async for message in channel.history():
if not msg.pinned:
await self.queue.put(message)
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)
@ -178,7 +182,7 @@ class Administration:
if channel.id not in u.tasks.setdefault('management', {}).setdefault('auto_delete', []): if channel.id not in u.tasks.setdefault('management', {}).setdefault('auto_delete', []):
u.tasks['management']['auto_delete'].append(channel.id) u.tasks['management']['auto_delete'].append(channel.id)
u.dump(u.tasks, 'cogs/tasks.pkl') 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()) self.bot.loop.create_task(self.delete())
print('Looping #{}'.format(channel.name)) print('Looping #{}'.format(channel.name))
await ctx.send('✅ **Auto-deleting all messages in this channel.**', delete_after=5) await ctx.send('✅ **Auto-deleting all messages in this channel.**', delete_after=5)

View file

@ -3,8 +3,9 @@ import json
import traceback import traceback
import discord import discord
from discord import errors as err
from discord.ext import commands 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 from utils import utils as u
@ -59,6 +60,11 @@ def is_nsfw():
def del_ctx(): def del_ctx():
async def predicate(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']: 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() await ctx.message.delete()
except err.NotFound:
pass
return True return True
return commands.check(predicate) return commands.check(predicate)

View file

@ -43,7 +43,7 @@ async def on_ready():
@bot.event @bot.event
async def on_error(error, *args, **kwargs): async def on_error(error, *args, **kwargs):
if isinstance(bot.get_channel(u.config['shutdown_channel']), d.TextChannel): 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() u.close()
await bot.logout() await bot.logout()
await bot.close() await bot.close()