22 )
23
24 # Custom ending note
25 ending_note = f"(C) 2022 Il BaracchinoDella Scuola"26
27 async def on_ready(self):
28
36 async def saytts(self, ctx, *, text):
37 temp = BytesIO()
38
39 tts = await self.tts.save(text, "tts.mp3", lang="it")40 voice_channel = ctx.author.voice.channel
41 if ctx.voice_client is not None:
42 await ctx.voice_client.move_to(voice_channel)
34
35 @commands.command()
36 async def saytts(self, ctx, *, text):
37 temp = BytesIO()38
39 tts = await self.tts.save(text, "tts.mp3", lang="it")
40 voice_channel = ctx.author.voice.channel
42 return
43
44 file = ctx.message.attachments[0]
45 c = self.bot.get_channel(int(838728591238758411)) 46
47 f = open("data/files/" + file.filename, "wb")
48 r = requests.get(file.url)
56 try:
57 with redirect_stdout(stdout):
58 ret = await func()
59 except Exception as e:60 value = stdout.getvalue()
61 await ctx.send(f"```py\n{value}{traceback.format_exc()}\n```")
62 else:
An unused variable takes up space in the code, and can lead to confusion, and it should be removed. If this variable is necessary, name the variable _
to indicate that it will be unused, or start the name with unused
or _unused
.
def update():
for i in range(10): # Usused variable `i`
time.sleep(0.01)
display_result()
def update():
for _ in range(10):
time.sleep(0.01)
display_result()