#How to check if a user is Online?
1 messages Β· Page 1 of 1 (latest)
do you have the presences intent enabled in the application page and code?
I have everything enabled
my code wouldnt work without intents
intents = discord.Intents().all()
prefix = "$p "
client = commands.Bot(command_prefix=prefix, intents=intents)
@snow bane
ok
any code?
related to this
what code
are you using that inside a command
^^
can you provide the code related to this
yes
@client.user_command(guild_ids=[972791561450573824], name="Pickpocket", pass_context=True)
async def pickpocket(ctx, user: discord.Member):
if ctx.author == user:
await ctx.respond("You cannot rob yourself!")
else:
if user.status is discord.Status.online:
# Check for the account of the author and of the user that is robbed
await config.open_account(ctx.author)
await config.open_account(user)
bal = await config.get_specific_bank_data(user)
robber = await config.get_specific_bank_data(ctx.author)
# Check if the robber or the author has less than 75k money
if int(bal[0]) < 75000:
await ctx.respond("The user has less than 75,000π!")
return
if int(robber[0]) < 75000:
await ctx.respond("You need to have atleast 75,000π to use this command!")
return
# Get the skill of the authro
skill = await config.get_specific_user_skills(ctx.author, type="stealing")
# Calculate the amount of cash to steal from the player
if skill["level"] / 5 < 1:
earnings = (random.randint(700, 3000) * (bal[0] / 10000)) / 100
else:
earnings = ((random.randint(700, 3000) * (bal[0] / 10000)) * skill["level"] / 5) / 100
earnings = round(earnings)
await config.update_bank_data(user, -1 * earnings, "wallet")
await config.update_bank_data(ctx.author, earnings, "wallet")
await ctx.respond(f"You stole {earnings}π")
else:
await ctx.respond("The user you are trying to steal from isn't Online!")
lemme check smth π
what π
works for me 