Reputation: 553
Here's my code
amount = 0
list = []
#b is the client
@b.command()
async def hello(ctx):
if list == []:
list.append("9")
list.append("10")
list.append("11")
list.append("12")
else:
amount += 1
print(list[amount])
So there's a couple things I want to do, every time I run the command through discord I want it to add 1 to the amount, I also want the things that I appended in the command to be permanently added to the list as those values will change every time I run the command.
This is an example of what I want to print out:
After I run it once:
9
After I run it twice:
10
After I run three times:
11
Upvotes: 1
Views: 126
Reputation: 2607
something like this? (dis.py questions arent necessarily accessible to test immediately)
lst = []
#b is the client
@b.command()
async def hello(ctx):
if not lst:
lst.append(9)
else:
last = lst[-1]
await ctx.send(last)
lst.append(last + 1)
Upvotes: 2