Answer the question
In order to leave comments, you need to log in
Why does the discord bot only see itself?
The discord bot needs to get the entire list of users and add it to the database (Mongo.db), but it only adds itself.
Although he sees others.
Intents included
Source code:
intents = discord.Intents.all()
Intents.members = True
bot = commands.Bot(command_prefix= '-', intents = intents)
@bot.event
async def on_ready():
for guild in bot.guilds:
for member in guild.members:
print(member)
post = {
"_id": member.id,
"balance": 0,
"xp": 0,
"lvl": 0
}
print(collection)
if collection.find({"_id": member.id}) == None:
collection.insert_one(post)
print('пользователь занесен в таблицу')
me.wizzy#1111
Collection(Database(MongoClient(host=['cluster0-shard-00-02.sbgr7.mongodb.net:27017', 'cluster0-shard-00-01.sbgr7.mongodb.net:27017', 'cluster0-shard-00-00.sbgr7.mongodb.net:27017'], document_class=dict, tz_aware=False, connect=True, retrywrites=True, w='majority', authsource='admin', replicaset='atlas-kvlg4c-shard-0', ssl=True), 'bot'), 'keta')
Server Monitoring#8312
Collection(Database(MongoClient(host=['cluster0-shard-00-02.sbgr7.mongodb.net:27017', 'cluster0-shard-00-01.sbgr7.mongodb.net:27017', 'cluster0-shard-00-00.sbgr7.mongodb.net:27017'], document_class=dict, tz_aware=False, connect=True, retrywrites=True, w='majority', authsource='admin', replicaset='atlas-kvlg4c-shard-0', ssl=True), 'bot'), 'keta')
ToNi#2025
Collection(Database(MongoClient(host=['cluster0-shard-00-02.sbgr7.mongodb.net:27017', 'cluster0-shard-00-01.sbgr7.mongodb.net:27017', 'cluster0-shard-00-00.sbgr7.mongodb.net:27017'], document_class=dict, tz_aware=False, connect=True, retrywrites=True, w='majority', authsource='admin', replicaset='atlas-kvlg4c-shard-0', ssl=True), 'bot'), 'keta')
! #0001
Collection(Database(MongoClient(host=['cluster0-shard-00-02.sbgr7.mongodb.net:27017', 'cluster0-shard-00-01.sbgr7.mongodb.net:27017', 'cluster0-shard-00-00.sbgr7.mongodb.net:27017'], document_class=dict, tz_aware=False, connect=True, retrywrites=True, w='majority', authsource='admin', replicaset='atlas-kvlg4c-shard-0', ssl=True), <bot'), 'keta')
HaGle#2222
Collection(Database(MongoClient(host=['cluster0-shard-00-02.sbgr7.mongodb.net:27017', 'cluster0-shard-00-01.sbgr7.mongodb.net:27017', 'cluster0-shard-00-00.sbgr7.mongodb.net:27017'], document_class=dict, tz_aware=False, connect=True, retrywrites=True, w='majority', authsource='admin', replicaset='atlas-kvlg4c-shard-0', ssl=True), <b>'bot'), 'keta')</b>
Seba#5041
Collection(Database(MongoClient(host=['cluster0-shard-00-02.sbgr7.mongodb.net:27017', 'cluster0-shard-00-01.sbgr7.mongodb.net:27017', 'cluster0-shard-00-00.sbgr7.mongodb.net:27017'], document_class=dict, tz_aware=False, connect=True, retrywrites=True, w='majority', authsource='admin', replicaset='atlas-kvlg4c-shard-0', ssl=True), bot'), 'keta')
Хагис#4815
Collection(Database(MongoClient(host=['cluster0-shard-00-02.sbgr7.mongodb.net:27017', 'cluster0-shard-00-01.sbgr7.mongodb.net:27017', 'cluster0-shard-00-00.sbgr7.mongodb.net:27017'], document_class=dict, tz_aware=False, connect=True, retrywrites=True, w='majority', authsource='admin', replicaset='atlas-kvlg4c-shard-0', ssl=True), 'bot'), 'keta')
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question