mirror of
https://github.com/myned/modufur.git
synced 2024-11-01 21:02:38 +00:00
Removed redundant "./" from file declarations, changed d.errors to err.
This commit is contained in:
parent
0777573193
commit
225bebff0a
2 changed files with 6 additions and 5 deletions
|
@ -2,6 +2,7 @@ import asyncio
|
||||||
import traceback as tb
|
import traceback as tb
|
||||||
|
|
||||||
import discord as d
|
import discord as d
|
||||||
|
from discord import errors as err
|
||||||
from discord.ext import commands
|
from discord.ext import commands
|
||||||
|
|
||||||
from misc import exceptions as exc
|
from misc import exceptions as exc
|
||||||
|
@ -80,7 +81,7 @@ class Administration:
|
||||||
for channel in channels:
|
for channel in channels:
|
||||||
try:
|
try:
|
||||||
ref = await channel.get_message(reference)
|
ref = await channel.get_message(reference)
|
||||||
except d.errors.NotFound:
|
except err.NotFound:
|
||||||
continue
|
continue
|
||||||
history = []
|
history = []
|
||||||
try:
|
try:
|
||||||
|
@ -135,7 +136,7 @@ class Administration:
|
||||||
try:
|
try:
|
||||||
if not message.pinned:
|
if not message.pinned:
|
||||||
await message.delete()
|
await message.delete()
|
||||||
except d.errors.NotFound:
|
except err.NotFound:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
async def on_message(self, channel):
|
async def on_message(self, channel):
|
||||||
|
@ -153,7 +154,7 @@ class Administration:
|
||||||
await self.queue.put(message)
|
await self.queue.put(message)
|
||||||
except exc.Abort:
|
except exc.Abort:
|
||||||
u.tasks['management']['auto_delete'].remove(channel.id)
|
u.tasks['management']['auto_delete'].remove(channel.id)
|
||||||
u.dump(u.tasks, './cogs/tasks.pkl')
|
u.dump(u.tasks, 'cogs/tasks.pkl')
|
||||||
print('Stopped looping {}'.format(channel.id))
|
print('Stopped looping {}'.format(channel.id))
|
||||||
await channel.send('✅ **Stopped deleting messages in** {}**.**'.format(channel.mention), delete_after=5)
|
await channel.send('✅ **Stopped deleting messages in** {}**.**'.format(channel.mention), delete_after=5)
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
|
@ -168,7 +169,7 @@ class Administration:
|
||||||
try:
|
try:
|
||||||
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.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))
|
||||||
|
|
|
@ -42,7 +42,7 @@ def dump(obj, filename):
|
||||||
pkl.dump(obj, outfile)
|
pkl.dump(obj, outfile)
|
||||||
|
|
||||||
|
|
||||||
tasks = setdefault('./cogs/tasks.pkl', {})
|
tasks = setdefault('cogs/tasks.pkl', {})
|
||||||
|
|
||||||
|
|
||||||
async def clear(obj, interval=10 * 60, replace=None):
|
async def clear(obj, interval=10 * 60, replace=None):
|
||||||
|
|
Loading…
Reference in a new issue