mirror of
https://github.com/myned/modufur.git
synced 2024-11-01 13:02:38 +00:00
Change reverse commands to continually type when processing
This commit is contained in:
parent
02147ad95a
commit
ea2de2c1d7
1 changed files with 78 additions and 81 deletions
|
@ -397,30 +397,29 @@ class MsG(cmds.Cog):
|
||||||
for attachment in ctx.message.attachments:
|
for attachment in ctx.message.attachments:
|
||||||
urls.append(attachment.url)
|
urls.append(attachment.url)
|
||||||
|
|
||||||
for url in urls:
|
async with ctx.channel.typing():
|
||||||
try:
|
for url in urls:
|
||||||
await ctx.trigger_typing()
|
try:
|
||||||
|
post, source, similarity = await scraper.get_post(url)
|
||||||
|
|
||||||
post, source, similarity = await scraper.get_post(url)
|
embed = d.Embed(
|
||||||
|
title=', '.join(post['artist']),
|
||||||
|
url=source,
|
||||||
|
color=ctx.me.color if isinstance(ctx.channel, d.TextChannel) else u.color)
|
||||||
|
embed.set_image(url=post['file_url'])
|
||||||
|
embed.set_author(
|
||||||
|
name=similarity,
|
||||||
|
icon_url=ctx.author.avatar_url)
|
||||||
|
embed.set_footer(
|
||||||
|
text=post['score'],
|
||||||
|
icon_url=self._get_icon(post['score']))
|
||||||
|
|
||||||
embed = d.Embed(
|
await ctx.send(embed=embed)
|
||||||
title=', '.join(post['artist']),
|
|
||||||
url=source,
|
|
||||||
color=ctx.me.color if isinstance(ctx.channel, d.TextChannel) else u.color)
|
|
||||||
embed.set_image(url=post['file_url'])
|
|
||||||
embed.set_author(
|
|
||||||
name=similarity,
|
|
||||||
icon_url=ctx.author.avatar_url)
|
|
||||||
embed.set_footer(
|
|
||||||
text=post['score'],
|
|
||||||
icon_url=self._get_icon(post['score']))
|
|
||||||
|
|
||||||
await ctx.send(embed=embed)
|
c += 1
|
||||||
|
|
||||||
c += 1
|
except exc.MatchError as e:
|
||||||
|
await ctx.send('**No probable match for:** `{}`'.format(e))
|
||||||
except exc.MatchError as e:
|
|
||||||
await ctx.send('**No probable match for:** `{}`'.format(e))
|
|
||||||
|
|
||||||
if not c:
|
if not c:
|
||||||
await u.add_reaction(ctx.message, '\N{CROSS MARK}')
|
await u.add_reaction(ctx.message, '\N{CROSS MARK}')
|
||||||
|
@ -471,43 +470,42 @@ class MsG(cmds.Cog):
|
||||||
raise exc.NotFound
|
raise exc.NotFound
|
||||||
|
|
||||||
n = 1
|
n = 1
|
||||||
for message, urls in links.items():
|
async with ctx.channel.typing():
|
||||||
for url in urls:
|
for message, urls in links.items():
|
||||||
try:
|
for url in urls:
|
||||||
await ctx.trigger_typing()
|
try:
|
||||||
|
post, source, similarity = await scraper.get_post(url)
|
||||||
|
|
||||||
post, source, similarity = await scraper.get_post(url)
|
embed = d.Embed(
|
||||||
|
title=', '.join(post['artist']),
|
||||||
|
url=source,
|
||||||
|
color=ctx.me.color if isinstance(ctx.channel, d.TextChannel) else u.color)
|
||||||
|
embed.set_image(url=post['file_url'])
|
||||||
|
embed.set_author(
|
||||||
|
name=similarity,
|
||||||
|
icon_url=message.author.avatar_url)
|
||||||
|
embed.set_footer(
|
||||||
|
text=post['score'],
|
||||||
|
icon_url=self._get_icon(post['score']))
|
||||||
|
|
||||||
embed = d.Embed(
|
await dest.send(embed=embed)
|
||||||
title=', '.join(post['artist']),
|
await message.add_reaction('\N{WHITE HEAVY CHECK MARK}')
|
||||||
url=source,
|
|
||||||
color=ctx.me.color if isinstance(ctx.channel, d.TextChannel) else u.color)
|
|
||||||
embed.set_image(url=post['file_url'])
|
|
||||||
embed.set_author(
|
|
||||||
name=similarity,
|
|
||||||
icon_url=message.author.avatar_url)
|
|
||||||
embed.set_footer(
|
|
||||||
text=post['score'],
|
|
||||||
icon_url=self._get_icon(post['score']))
|
|
||||||
|
|
||||||
await dest.send(embed=embed)
|
if remove:
|
||||||
await message.add_reaction('\N{WHITE HEAVY CHECK MARK}')
|
with suppress(err.NotFound):
|
||||||
|
await message.delete()
|
||||||
|
|
||||||
if remove:
|
except exc.MatchError as e:
|
||||||
with suppress(err.NotFound):
|
await dest.send('`{} / {}` **No probable match for:** `{}`'.format(n, len(links), e))
|
||||||
await message.delete()
|
await message.add_reaction('\N{CROSS MARK}')
|
||||||
|
c -= 1
|
||||||
|
except exc.SizeError as e:
|
||||||
|
await dest.send(f'`{e}` **too large.** Maximum is 8 MB')
|
||||||
|
await message.add_reaction('\N{CROSS MARK}')
|
||||||
|
c -= 1
|
||||||
|
|
||||||
except exc.MatchError as e:
|
finally:
|
||||||
await dest.send('`{} / {}` **No probable match for:** `{}`'.format(n, len(links), e))
|
n += 1
|
||||||
await message.add_reaction('\N{CROSS MARK}')
|
|
||||||
c -= 1
|
|
||||||
except exc.SizeError as e:
|
|
||||||
await dest.send(f'`{e}` **too large.** Maximum is 8 MB')
|
|
||||||
await message.add_reaction('\N{CROSS MARK}')
|
|
||||||
c -= 1
|
|
||||||
|
|
||||||
finally:
|
|
||||||
n += 1
|
|
||||||
|
|
||||||
if c <= 0:
|
if c <= 0:
|
||||||
await u.add_reaction(ctx.message, '\N{CROSS MARK}')
|
await u.add_reaction(ctx.message, '\N{CROSS MARK}')
|
||||||
|
@ -535,40 +533,39 @@ class MsG(cmds.Cog):
|
||||||
for attachment in message.attachments:
|
for attachment in message.attachments:
|
||||||
urls.append(attachment.url)
|
urls.append(attachment.url)
|
||||||
|
|
||||||
for url in urls:
|
async with message.channel.typing():
|
||||||
try:
|
for url in urls:
|
||||||
await message.channel.trigger_typing()
|
try:
|
||||||
|
post, source, similarity = await scraper.get_post(url)
|
||||||
|
|
||||||
post, source, similarity = await scraper.get_post(url)
|
embed = d.Embed(
|
||||||
|
title=', '.join(post['artist']),
|
||||||
|
url=source,
|
||||||
|
color=message.channel.guild.me.color if isinstance(message.channel, d.TextChannel) else u.color)
|
||||||
|
embed.set_image(url=post['file_url'])
|
||||||
|
embed.set_author(
|
||||||
|
name=similarity,
|
||||||
|
icon_url=message.author.avatar_url)
|
||||||
|
embed.set_footer(
|
||||||
|
text=post['score'],
|
||||||
|
icon_url=self._get_icon(post['score']))
|
||||||
|
|
||||||
embed = d.Embed(
|
await message.channel.send(embed=embed)
|
||||||
title=', '.join(post['artist']),
|
|
||||||
url=source,
|
|
||||||
color=message.channel.guild.me.color if isinstance(message.channel, d.TextChannel) else u.color)
|
|
||||||
embed.set_image(url=post['file_url'])
|
|
||||||
embed.set_author(
|
|
||||||
name=similarity,
|
|
||||||
icon_url=message.author.avatar_url)
|
|
||||||
embed.set_footer(
|
|
||||||
text=post['score'],
|
|
||||||
icon_url=self._get_icon(post['score']))
|
|
||||||
|
|
||||||
await message.channel.send(embed=embed)
|
await message.add_reaction('\N{WHITE HEAVY CHECK MARK}')
|
||||||
|
|
||||||
await message.add_reaction('\N{WHITE HEAVY CHECK MARK}')
|
with suppress(err.NotFound):
|
||||||
|
await message.delete()
|
||||||
|
|
||||||
with suppress(err.NotFound):
|
except exc.MatchError as e:
|
||||||
await message.delete()
|
await message.channel.send('**No probable match for:** `{}`'.format(e))
|
||||||
|
await message.add_reaction('\N{CROSS MARK}')
|
||||||
except exc.MatchError as e:
|
except exc.SizeError as e:
|
||||||
await message.channel.send('**No probable match for:** `{}`'.format(e))
|
await message.channel.send(f'`{e}` **too large.** Maximum is 8 MB')
|
||||||
await message.add_reaction('\N{CROSS MARK}')
|
await message.add_reaction('\N{CROSS MARK}')
|
||||||
except exc.SizeError as e:
|
except Exception:
|
||||||
await message.channel.send(f'`{e}` **too large.** Maximum is 8 MB')
|
await message.channel.send(f'**An unknown error occurred.**')
|
||||||
await message.add_reaction('\N{CROSS MARK}')
|
await message.add_reaction('\N{WARNING SIGN}')
|
||||||
except Exception:
|
|
||||||
await message.channel.send(f'**An unknown error occurred.**')
|
|
||||||
await message.add_reaction('\N{WARNING SIGN}')
|
|
||||||
|
|
||||||
print('STOPPED : reversifying')
|
print('STOPPED : reversifying')
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue