mirror of
https://github.com/myned/modufur.git
synced 2024-12-25 14:47:29 +00:00
Misc tweaks
This commit is contained in:
parent
d8d4b85074
commit
72279ef005
1 changed files with 9 additions and 12 deletions
|
@ -23,7 +23,7 @@ class Administration:
|
||||||
for channel in u.tasks['auto_del']:
|
for channel in u.tasks['auto_del']:
|
||||||
temp = self.bot.get_channel(channel)
|
temp = self.bot.get_channel(channel)
|
||||||
self.bot.loop.create_task(self.queue_on_message(temp))
|
self.bot.loop.create_task(self.queue_on_message(temp))
|
||||||
print('Looping #{}'.format(temp.name))
|
print('LOOPING : #{}'.format(temp.name))
|
||||||
self.bot.loop.create_task(self.delete())
|
self.bot.loop.create_task(self.delete())
|
||||||
self.deleting = True
|
self.deleting = True
|
||||||
|
|
||||||
|
@ -103,17 +103,18 @@ class Administration:
|
||||||
if not message.pinned:
|
if not message.pinned:
|
||||||
await message.delete()
|
await message.delete()
|
||||||
|
|
||||||
|
print('STOPPED : deleting')
|
||||||
|
|
||||||
async def queue_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
|
||||||
elif msg.channel is channel and not msg.pinned:
|
elif msg.channel is channel and not msg.pinned:
|
||||||
return True
|
return True
|
||||||
else:
|
return False
|
||||||
return False
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
async for message in channel.history():
|
async for message in channel.history(limit=None):
|
||||||
if message.content.lower() == 'stop' and message.author.guild_permissions.administrator:
|
if message.content.lower() == 'stop' and message.author.guild_permissions.administrator:
|
||||||
raise exc.Abort
|
raise exc.Abort
|
||||||
if not message.pinned:
|
if not message.pinned:
|
||||||
|
@ -128,13 +129,9 @@ class Administration:
|
||||||
u.dump(u.tasks, 'cogs/tasks.pkl')
|
u.dump(u.tasks, 'cogs/tasks.pkl')
|
||||||
if not u.tasks['auto_del']:
|
if not u.tasks['auto_del']:
|
||||||
self.deleting = False
|
self.deleting = False
|
||||||
print('Stopped deleting.')
|
print('STOPPED : looping #{}'.format(channel.name))
|
||||||
print('Stopped looping #{}'.format(channel.name))
|
|
||||||
await channel.send('✅ **Stopped queueing messages for deletion in** {}**.**'.format(channel.mention), delete_after=5)
|
await channel.send('✅ **Stopped queueing messages for deletion in** {}**.**'.format(channel.mention), delete_after=5)
|
||||||
|
|
||||||
except AttributeError:
|
|
||||||
pass
|
|
||||||
|
|
||||||
@commands.command(name='autodelete', aliases=['autodel', 'ad'])
|
@commands.command(name='autodelete', aliases=['autodel', 'ad'])
|
||||||
@commands.has_permissions(administrator=True)
|
@commands.has_permissions(administrator=True)
|
||||||
@checks.del_ctx()
|
@checks.del_ctx()
|
||||||
|
@ -147,13 +144,13 @@ class Administration:
|
||||||
if not self.deleting:
|
if not self.deleting:
|
||||||
self.bot.loop.create_task(self.delete())
|
self.bot.loop.create_task(self.delete())
|
||||||
self.deleting = True
|
self.deleting = True
|
||||||
print('Looping #{}'.format(ctx.channel.name))
|
print('LOOPING : #{}'.format(ctx.channel.name))
|
||||||
await ctx.send('✅ **Auto-deleting all messages in this channel.**', delete_after=5)
|
await ctx.send('✅ **Auto-deleting all messages in {}.**'.format(ctx.channel.mention), delete_after=5)
|
||||||
else:
|
else:
|
||||||
raise exc.Exists
|
raise exc.Exists
|
||||||
|
|
||||||
except exc.Exists:
|
except exc.Exists:
|
||||||
await ctx.send('❌ **Already auto-deleting in this channel.** Type `stop` to stop.', delete_after=10)
|
await ctx.send('❌ **Already auto-deleting in {}.** Type `stop` to stop.'.format(ctx.channel.mention), delete_after=10)
|
||||||
|
|
||||||
@commands.command(name='deletecommands', aliases=['delcmds'])
|
@commands.command(name='deletecommands', aliases=['delcmds'])
|
||||||
@commands.has_permissions(administrator=True)
|
@commands.has_permissions(administrator=True)
|
||||||
|
|
Loading…
Reference in a new issue