Асинхронная работа бота Discord с несколькими пользователями сразу
Столкнулся с проблемой. Пишу бота, который работает с DM каналом пользователей.
import disnake
from disnake.ext import commands
from config import settings
intents = disnake.Intents.default()
intents.message_content = True
bot = commands.Bot(command_prefix = settings['prefix'], intents = intents )
class step1(disnake.ui.View):
@disnake.ui.button(style=disnake.ButtonStyle.blurple,label='Player info')
async def one1 (self,button:disnake.Button,interaction:disnake.Interaction):
await msg.edit('PlayerINFO',view=playerinfo())
@disnake.ui.button(style=disnake.ButtonStyle.blurple,label='Guild')
async def two1 (self,button:disnake.Button,interaction:disnake.Interaction):
await interaction.channel.send('Guild Info:test')
@disnake.ui.button(style=disnake.ButtonStyle.blurple,label='Quest')
async def three1 (self,button:disnake.Button,interaction:disnake.Interaction):
await interaction.channel.send('Quest Info:test')
@disnake.ui.button(style=disnake.ButtonStyle.blurple,label='Report')
async def four1 (self,button:disnake.Button,interaction:disnake.Interaction):
await interaction.channel.send('Report:test')
class playerinfo(disnake.ui.View):
@disnake.ui.button(style=disnake.ButtonStyle.blurple,label='Check')
async def one1 (self,button:disnake.Button,interaction:disnake.Interaction):
await interaction.channel.send('Check')
@disnake.ui.button(style=disnake.ButtonStyle.blurple,label='Write')
async def two1 (self,button:disnake.Button,interaction:disnake.Interaction):
await interaction.channel.send('Check')
@disnake.ui.button(style=disnake.ButtonStyle.blurple,label='Back')
async def three1 (self,button:disnake.Button,interaction:disnake.Interaction):
await msg.edit("Menu",view=step1())
@bot.command()
async def button(ctx):
global msg
msg = await ctx.reply("Menu",view=step1())
print("test")
bot.run(settings['token'])
Собственно, проблема в том, что при использовании команды "/button" или переходе на разные уровни меню(как пример, playerinfo) несколькими пользователями приводит к тому, что бот не реагирует на команды всех пользователей, кроме последнего.