1
0
Fork 0
mirror of https://github.com/myned/modufur.git synced 2024-11-01 13:02:38 +00:00

Fixed KeyError, added limit extension, and playing with last_command

This commit is contained in:
Myned 2017-10-02 15:20:04 -04:00
parent 9041af8463
commit 41c5f86181

View file

@ -28,12 +28,12 @@ import traceback
from discord import reaction from discord import reaction
from discord.ext import commands from discord.ext import commands
from discord import errors as err from discord import errors as err
from cogs import tools
from misc import checks from misc import checks
from misc import exceptions as exc from misc import exceptions as exc
from utils import formatter, scraper from utils import formatter, scraper
headers = {'user-agent': 'Modumind/0.0.1 (Myned)'} headers = {'user-agent': 'Modumind/0.0.1 (Myned)'}
last_command = {}
class MsG: class MsG:
@ -116,6 +116,7 @@ class MsG:
except Exception: except Exception:
await ctx.send(exc.base + '\n```python' + traceback.format_exc(limit=1) + '```') await ctx.send(exc.base + '\n```python' + traceback.format_exc(limit=1) + '```')
traceback.print_exc() traceback.print_exc()
tools.command_dict.setdefault(str(ctx.message.author.id), {}).update({'command': ctx.command, 'args': ctx.args})
@e621.error @e621.error
async def e621_error(self, ctx, error): async def e621_error(self, ctx, error):
@ -172,11 +173,10 @@ class MsG:
# Creates temp blacklist based on context # Creates temp blacklist based on context
for k, v in aliases['global_blacklist'].items(): for k, v in aliases['global_blacklist'].items():
blacklist.extend([k] + v) blacklist.extend([k] + v)
for k, v in aliases['guild_blacklist'][str(guild.id)][str(channel.id)].items(): for k, v in aliases['guild_blacklist'].get(str(guild.id), {}).get(str(channel.id), {}).items():
blacklist.extend([k] + v) blacklist.extend([k] + v)
for k, v in aliases['user_blacklist'][str(user.id)].items(): for k, v in aliases['user_blacklist'].get(str(user.id), {}).items():
blacklist.extend([k] + v) blacklist.extend([k] + v)
print(blacklist)
# Checks if tags are in local blacklists # Checks if tags are in local blacklists
if args: if args:
for tag in args: for tag in args:
@ -201,7 +201,7 @@ class MsG:
if len(urls) == limit: if len(urls) == limit:
break break
c += 1 c += 1
if c == 50: if c == 50 + limit:
raise exc.Timeout raise exc.Timeout
for url in urls: for url in urls:
await ctx.send('`' + formatter.tostring(args) + '`\n' + url) await ctx.send('`' + formatter.tostring(args) + '`\n' + url)