@VickR0mE

Как изменить interaction?

Суть такова: пользователь нажимает на кнопку, дальше идет цикл, который меняет сообщение каждые 3 секунды, пока цикл не завершится.
async def button_collect_callback(interaction):
					if ctx.author == interaction.author:
						hk = 10
						time_set = datetime.datetime.now()
						emb = disnake.Embed(
							title = "⚔️ Бой.",
							description = "Вы атакуете!",
							color = 0x5a00b3
						)
						emb.set_image(file = disnake.File("./kaban.jpg"))
						emb.set_footer(text = f'{self.bot.user.name} | {time_set.strftime("%Y-%m-%d, %H:%M:%S")}', icon_url = self.bot.user.avatar)
						emb.add_field(name = "Малый кабан:", value = f"{hk}/10 ❤️", inline = False)
						emb.add_field(name = f"{ctx.author}:", value = f"{user['health1']}/{user['health2']} ❤️", inline = False)
						await interaction.response.edit_message(embed = emb, view = None)
						while hk != 0:
							if user['health1'] != 0:
								emb = disnake.Embed(
									title = "⚔️ Бой.",
									description = "Вы атакуете!",
									color = 0x5a00b3
								)
								emb.set_image(file = disnake.File("./kaban.jpg"))
								emb.set_footer(text = f'{self.bot.user.name} | {time_set.strftime("%Y-%m-%d, %H:%M:%S")}', icon_url = self.bot.user.avatar)
								emb.add_field(name = "Малый кабан:", value = f"{hk}/10 ❤️", inline = False)
								emb.add_field(name = f"{ctx.author}:", value = f"{user['health1']}/{user['health2']} ❤️", inline = False)
								await interaction.response.edit_message(embed = emb)

								await asyncio.sleep(3)
								hk = hk - user['phisic_power']
								emb = disnake.Embed(
									title = "⚔️ Бой.",
									description = "`Малый кабан` атакует!",
									color = 0x5a00b3
								)
								emb.set_image(file = disnake.File("./kaban.jpg"))
								emb.set_footer(text = f'{self.bot.user.name} | {time_set.strftime("%Y-%m-%d, %H:%M:%S")}', icon_url = self.bot.user.avatar)
								emb.add_field(name = "Малый кабан:", value = f"{hk}/10 ❤️", inline = False)
								emb.add_field(name = f"{ctx.author}:", value = f"{user['health1']}/{user['health2']} ❤️", inline = False)
								await interaction.response.edit_message(embed = emb)

								await asyncio.sleep(3)
								await self.db.update_member("UPDATE rpg SET health1 = user['health1'] - ? WHERE member_id = ? AND guild_id = ?", [5, interaction.author.id, interaction.guild.id])
							else:
								emb = disnake.Embed(
									title = "⚔️ Бой.", 
									description = "Вы проиграли!", 
									color = 0xff2b20
								)
								emb.set_footer(text = f'{self.bot.user.name} | {time_set.strftime("%Y-%m-%d, %H:%M:%S")}', icon_url = self.bot.user.avatar)
								await interaction.response.edit_message(embed = emb)
						else:
							bones = random.randint(1, 3)
							meat = random.randint(2, 3)
							skin = random.randint(0,1)
							emb_award = disnake.Embed(
								title = "⚔️ Бой.",
								description = "Вы победили!",
								color = 0x00FF00
							)		
							emb.add_field(name = "Вы добыли:", value = f"<:bones:1121435895799746580> {bones}\n<:meat:1121444594157109328> {meat}\n<:skin:1121435977878085782> {skin}", inline = False)
							emb.set_footer(text = f'{self.bot.user.name} | {time_set.strftime("%Y-%m-%d, %H:%M:%S")}', icon_url = self.bot.user.avatar)
							await self.db.update_member("UPDATE rpg SET bones = bones + ? AND leather = leather + ? AND meat = meat + ? WHERE member_id = ? AND guild_id = ?", [bones, skin, meat, interaction.author.id, interaction.guild.id])
							await interaction.response.edit_message(embed = emb)
					else:
						return
  • Вопрос задан
  • 102 просмотра
Пригласить эксперта
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Похожие вопросы