1
0
Fork 0
mirror of https://github.com/myned/modufur.git synced 2024-12-25 06:37:29 +00:00

Changed "stop" tasks command to be specific to each task (ie stop rev)

This commit is contained in:
Myned 2017-12-31 21:28:58 -05:00
parent 165d134b6d
commit 70ec1bdb9c
2 changed files with 17 additions and 15 deletions

View file

@ -124,9 +124,9 @@ class MsG:
while self.hearting: while self.hearting:
temp = await self.heartqueue.get() temp = await self.heartqueue.get()
await temp[0].send(embed=temp[1]) await temp[0].send(embed=temp[1])
await asyncio.sleep(self.RATE_LIMIT) await asyncio.sleep(self.RATE_LIMIT)
print('STOPPED : hearting') print('STOPPED : hearting')
@ -135,21 +135,23 @@ class MsG:
if reaction.emoji == '\N{HEAVY BLACK HEART}' and reaction.message.id == message.id: if reaction.emoji == '\N{HEAVY BLACK HEART}' and reaction.message.id == message.id:
raise exc.Save(user) raise exc.Save(user)
return False return False
if 'stop h' in msg.content.lower():
try: try:
await message.add_reaction('\N{HEAVY BLACK HEART}') await message.add_reaction('\N{HEAVY BLACK HEART}')
await asyncio.sleep(1) await asyncio.sleep(1)
while self.hearting: while self.hearting:
try: try:
await asyncio.gather(*[self.bot.wait_for('reaction_add', check=on_reaction, timeout=60 * 60), await asyncio.gather(*[self.bot.wait_for('reaction_add', check=on_reaction, timeout=60 * 60),
self.bot.wait_for('reaction_remove', check=on_reaction, timeout=60 * 60)]) self.bot.wait_for('reaction_remove', check=on_reaction, timeout=60 * 60)])
except exc.Save as e: except exc.Save as e:
await self.heartqueue.put((e.user, send)) await self.heartqueue.put((e.user, send))
except asyncio.TimeoutError: except asyncio.TimeoutError:
await message.add_reaction('\N{WHITE HEAVY CHECK MARK}') await message.add_reaction('\N{WHITE HEAVY CHECK MARK}')
await ctx.send('**Already auto-hearting in {}.** Type `stop h(earting)` to stop.'.format(ctx.channel.mention), delete_after=7)
# @cmds.command() # @cmds.command()
# async def auto_post(self, ctx): # async def auto_post(self, ctx):
@ -518,7 +520,7 @@ class MsG:
async def queue_for_reversification(self, channel): async def queue_for_reversification(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 'stop r' in msg.content.lower() and msg.channel is channel and msg.author.guild_permissions.administrator:
raise exc.Abort raise exc.Abort
elif msg.channel is channel and msg.author.id != self.bot.user.id and (re.search('(https?:\/\/[^ ]*\.(?:gif|png|jpg|jpeg))', msg.content) is not None or msg.attachments or msg.embeds): elif msg.channel is channel and msg.author.id != self.bot.user.id and (re.search('(https?:\/\/[^ ]*\.(?:gif|png|jpg|jpeg))', msg.content) is not None or msg.attachments or msg.embeds):
return True return True
@ -553,7 +555,7 @@ class MsG:
print('STARTED : auto-reversifying in #{}'.format(ctx.channel.name)) print('STARTED : auto-reversifying in #{}'.format(ctx.channel.name))
await ctx.send('**Auto-reversifying all images in** {}'.format(ctx.channel.mention), delete_after=5) await ctx.send('**Auto-reversifying all images in** {}'.format(ctx.channel.mention), delete_after=5)
else: else:
await ctx.send('**Already auto-reversifying in {}.** Type `stop` to stop.'.format(ctx.channel.mention), delete_after=7) await ctx.send('**Already auto-reversifying in {}.** Type `stop r(eversifying)` to stop.'.format(ctx.channel.mention), delete_after=7)
await ctx.message.add_reaction('\N{CROSS MARK}') await ctx.message.add_reaction('\N{CROSS MARK}')
async def _get_pool(self, ctx, *, destination, booru='e621', query=[]): async def _get_pool(self, ctx, *, destination, booru='e621', query=[]):

View file

@ -128,7 +128,7 @@ class Administration:
async def queue_for_deletion(self, channel): async def queue_for_deletion(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 'stop d' in msg.content.lower() 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
@ -136,7 +136,7 @@ class Administration:
try: try:
async for message in channel.history(limit=None): async for message in channel.history(limit=None):
if message.content.lower() == 'stop' and message.author.guild_permissions.administrator: if 'stop d' in message.content.lower() and message.author.guild_permissions.administrator:
raise exc.Abort raise exc.Abort
if not message.pinned: if not message.pinned:
await self.queue.put(message) await self.queue.put(message)
@ -170,7 +170,7 @@ class Administration:
raise exc.Exists raise exc.Exists
except exc.Exists: except exc.Exists:
await ctx.send('**Already auto-deleting in {}.** Type `stop` to stop.'.format(ctx.channel.mention), delete_after=7) await ctx.send('**Already auto-deleting in {}.** Type `stop d(eleting)` to stop.'.format(ctx.channel.mention), delete_after=7)
await ctx.message.add_reaction('\N{CROSS MARK}') await ctx.message.add_reaction('\N{CROSS MARK}')
@cmds.group(aliases=['setting', 'set', 's']) @cmds.group(aliases=['setting', 'set', 's'])