'I'm trying to get user Id and put it in txt file from which role has in one server. discord.py
so, as I said, I'm trying to get user Id from specific role which has the member, and put it inside a txt file, this is the code that I did:
@client.event
async def on_member_update(before, after):
if len(before.roles) < len(after.roles):
premium = next(role for role in after.roles if role not in before.roles)
if premium.id == "945200418181480459":
with open('miao.txt', 'a') as f:
f.write(f"{str(user_id)}\n")
f.close()
but don't work, no error, nothing. any help is appreciated!
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
