mirror of
https://github.com/nexy7574/LCC-bot.git
synced 2024-09-20 02:26:32 +01:00
add a slight error message
This commit is contained in:
parent
44710e4c8c
commit
2f970d4297
1 changed files with 6 additions and 1 deletions
|
@ -866,7 +866,10 @@ class OtherCog(commands.Cog):
|
||||||
await interaction.response.defer()
|
await interaction.response.defer()
|
||||||
_msg = await interaction.followup.send("Converting text to MP3...")
|
_msg = await interaction.followup.send("Converting text to MP3...")
|
||||||
text_pre = self.children[0].value
|
text_pre = self.children[0].value
|
||||||
|
try:
|
||||||
_io = await _bot.loop.run_in_executor(None, _convert, text_pre)
|
_io = await _bot.loop.run_in_executor(None, _convert, text_pre)
|
||||||
|
except (Exception, IOError) as e:
|
||||||
|
return await _msg.edit(content="failed. " + str(e))
|
||||||
fn = ""
|
fn = ""
|
||||||
_words = text_pre.split()
|
_words = text_pre.split()
|
||||||
while len(fn) < 28:
|
while len(fn) < 28:
|
||||||
|
@ -877,6 +880,8 @@ class OtherCog(commands.Cog):
|
||||||
if len(fn) + len(word) + 1 > 28:
|
if len(fn) + len(word) + 1 > 28:
|
||||||
continue
|
continue
|
||||||
fn += word + "-"
|
fn += word + "-"
|
||||||
|
fn = fn[:-1]
|
||||||
|
fn = fn[:28]
|
||||||
await _msg.edit(
|
await _msg.edit(
|
||||||
content="Here's your MP3!",
|
content="Here's your MP3!",
|
||||||
file=discord.File(_io, filename=fn + ".mp3")
|
file=discord.File(_io, filename=fn + ".mp3")
|
||||||
|
|
Loading…
Reference in a new issue