M
M
mariksolohin2021-11-13 20:22:12
Python
mariksolohin, 2021-11-13 20:22:12

How to count the number of bots on the server?

You need to count the number of all bots on the Discord server. Python. How many tried, but the bot considers only itself

for i in ctx.guild.members:
      if i.bot:
        bots +=1

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
soremix, 2021-11-13
@mariksolohin

What intents were passed when creating the bot? Most likely there are no necessary
https://discordpy.readthedocs.io/en/stable/intents.html
At least guild, messages and members are needed.

intents = discord.Intents.default()
intents.members = True

bot = commands.Bot(command_prefix='!', intents=intents)

N
Nicholas, 2021-11-14
@pkeorley

You can just use this simple code
ctx.guild.bots

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question