R
R
Retan02021-12-27 12:14:32
Python
Retan0, 2021-12-27 12:14:32

Discord.py tuple and split, what's the problem?

@commands.command(pass_context=True)
async def choice(self, ctx, *args:str):
choices = " ".join(args.split()[0:]).split(", ")
choiced = f "{random.choice(choices)}"
count = len(choices)

if count > 1:
embed = discord.Embed(title=f"{choiced}", description=f"{choices}", color=0x630099 ) embed.set_footer
(text=f"Requesting {ctx.author.name}")
await ctx.send(embed=embed)
else:
await ctx.send("-")
help choices = " ".join(list(args).split()[0:]).split(", ")
still do, but somehow it didn’t work

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
Retan0, 2021-12-27
@Retan0

Everything was simple, choices = " ".join(args).split(", "),instead of choices = " ".join(args.split()[0:]).split(", ")

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question