Reputation: 37
I wanted to subtract from a variable in this code, but it won't subtract it. I tried setting it global. What should I do?
rui=7
@commands.cooldown(1, 10, commands.BucketType.user)
@client.command(pass_context=True)
async def m(ctx):
user = await client.fetch_user("MY ID HERE")
mesa = ctx.author.id
now = datetime.now()
global rui
await DMChannel.send(user,"-\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n#################\n# ROLL ÉRTESÍTŐ #\n#################\n\nA rollolás megkezdve a szobában az alábbi időben: {}\nRollolást megkezdte: {}".format(now,mesa))
if mesa=="MY ID HERE":
rui-=1
I tried requesting the variables with another command, but it says the original variable numbers (7). What am I doing wrong?
If it is required I can send the full code in. But I think it isn't needed. (Hopefully)
Thanks for every bit of help
Upvotes: 0
Views: 43
Reputation: 2663
Make sure the user id you're passing is int
type, not str
because it won't work otherwise.
rui=7
@commands.cooldown(1, 10, commands.BucketType.user)
@client.command() # you don't have to use 'pass_context=True'
async def m(ctx):
user = await client.fetch_user(1234567890) # your id as int
mesa = ctx.author.id
now = datetime.now()
global rui
await DMChannel.send(user,"-\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n#################\n# ROLL ÉRTESÍTŐ #\n#################\n\nA rollolás megkezdve a szobában az alábbi időben: {}\nRollolást megkezdte: {}".format(now,mesa))
if mesa==1234567890: # your id as int
rui-=1
Upvotes: 1