У меня id роли верный насчёт guld хз но в консоль выводит просто как название сервера
@commands.Cog.listener()
async def on_message(self, message):
if message.author == self.bot.user:
return
user_id = message.author.id
user_name = message.author.name
xp_amount = 0
current_time = time.time()
if message.attachments:
xp_amount = 150
else:
xp_amount = 100
if user_id in self.last_xp_update:
time_since_last_update = current_time - self.last_xp_update[user_id]
if time_since_last_update < self.xp_delay:
return
self.last_xp_update[user_id] = current_time
database.increase_xp(user_id, user_name, xp_amount)
guild_id = message.guild.id
guild = self.bot.get_guild(guild_id)
member = guild.get_member(user_id)
if member:
print(guild)
id_role = db_levels.get_id_role(database.get_lvl(user_id, user_name))
if id_role:
print(id_role)
role = guild.get_role(id_role)
print(role)
if role:
print(3)
await member.add_roles(role)