ibegames
ibegames

Reputation: 23

How to automatically get the server id

I'm trying to automatically get the server id automatically in a message so it can automatically know which server it's in. i need this for a member count message shown in the code below

OK, just as a little background, I'm new to this type of thing and not really good at it.

my code:

id = client.get_guild(server id here)
    if message.content == "member count":
        await message.channel.send(f"""**Member Count**: {id.member_count}""")```

Upvotes: 2

Views: 640

Answers (1)

Axisnix
Axisnix

Reputation: 2907

You can do in a on_message use message.guild.id

in a command async def ping use ctx.guild.id

Upvotes: 1

Related Questions