Here is my code:
@client.command()
async def test(ctx, *args):
if ctx.channel.id != 850806578125864981:
return
else:
for arg in args:
if arg == "g.basic":
arg = "[18.25, 1.4, .1, 1, 2, .2, 1, 4.5, 1, 1, 1, 15, 1]"
for arg in args:
if arg == "g.drone":
arg = "[68, .25, .1, .6, 4.97, .295/*.3*/, .96, 2.305, 1, 1, 1, .1, 1.1]"
await ctx.send(args)
Let's say I type ,test [2, 2, 2, 2, 2, 2. 2,05, 2, 2, 2, 2, 2. 2] g,basic [3, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4. 2] g.drone
How can I get the bot to output [2, 2, 2, 2, 2, 2, 2.05, 2, 2, 2, 2, 2, 2] [18.25, 1.4, .1, 1, 2, .2, 1, 4.5, 1, 1, 1, 15, 1] [3, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2] [68, .25, .1, .6, 4.97, .295/*.3*/, .96, 2.305, 1, 1, 1, .1, 1.1]
?
The above code is my failed attempt to make this work. Any help would be greatly appreciated!
I can't 100% understand what you're going for, but you should make a empty list at the beginning, and append the number strings to it whenever the condition is met, then make it a string with:
args = " ".join(args)
then you can return that, declaring
if arg == x:
arg = "y"
doesnt do anything if you don't touch the var "arg" you made, since thats not editing the list.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.