回答編集履歴

6

shuusei

2022/12/19 03:12

投稿

banana
banana

スコア8

test CHANGED
@@ -1,6 +1,6 @@
1
1
  ```python
2
2
  @bot.command()
3
- async def help(ctx):
3
+ async def help(Interaction: discord.Interaction):
4
4
  buttons=["⏮️","⏪","⬅️","➡️","⏩","⏭"]
5
5
  counts=0
6
6
  page1=

5

shuusei

2022/12/17 12:41

投稿

banana
banana

スコア8

test CHANGED
@@ -1,3 +1,4 @@
1
+ ```python
1
2
  @bot.command()
2
3
  async def help(ctx):
3
4
  buttons=["⏮️","⏪","⬅️","➡️","⏩","⏭"]
@@ -34,4 +35,4 @@
34
35
  counts += 3
35
36
  await embed.remove_reaction(reaction, user)
36
37
  if counts != preview_pages:
37
- await embed.edit(embed=embed_list[counts])
38
+ await embed.edit(embed=embed_list[counts])```

4

修正

2022/12/17 03:30

投稿

banana
banana

スコア8

test CHANGED
@@ -1,5 +1,5 @@
1
- @bot.slash_command(name=f"help",description=f"helpを表示します")
1
+ @bot.command()
2
- async def help(Interaction):
2
+ async def help(ctx):
3
3
  buttons=["⏮️","⏪","⬅️","➡️","⏩","⏭"]
4
4
  counts=0
5
5
  page1=

3

なぜか途切れていたのでしゅうせいしました

2022/12/17 03:29

投稿

banana
banana

スコア8

test CHANGED
@@ -1 +1,37 @@
1
+ @bot.slash_command(name=f"help",description=f"helpを表示します")
2
+ async def help(Interaction):
3
+ buttons=["⏮️","⏪","⬅️","➡️","⏩","⏭"]
4
+ counts=0
5
+ page1=
6
+ page2=
7
+ page3=
8
+ page4=
9
+ page5=
10
+ page6=
11
+ embed_list=[page1,page2,page3,page4,page5,page6]
12
+ embed=await Interaction.send(embed=embed_list[counts])
13
+ for button in buttons:
14
+ await embed.add_reaction(button)
15
+ while True:
16
+ try:
17
+ reaction, user=await bot.wait_for("reaction_add",timeout=500,check=lambda reaction, user: user == Interaction.author and reaction.emoji in buttons)
18
+ except asyncio.TimeoutError:
19
+ await embed.delete()
20
+ break
21
+ else:
22
+ preview_pages=counts
23
+ if reaction.emoji == "⬅️":
1
- @bot.comma
24
+ counts -= 1
25
+ elif reaction.emoji == "➡️":
26
+ counts += 1
27
+ elif reaction.emoji == "⏪":
28
+ counts -= 2
29
+ elif reaction.emoji == "⏩":
30
+ counts += 2
31
+ elif reaction.emoji == "⏮️":
32
+ counts -= 3
33
+ elif reaction.emoji == "⏭":
34
+ counts += 3
35
+ await embed.remove_reaction(reaction, user)
36
+ if counts != preview_pages:
37
+ await embed.edit(embed=embed_list[counts])

2

a

2022/11/17 06:07

投稿

banana
banana

スコア8

test CHANGED
@@ -1 +1 @@
1
- @b.command
1
+ @bot.comma

1

誤字の修正

2022/11/17 06:02

投稿

banana
banana

スコア8

test CHANGED
@@ -1,18 +1 @@
1
- while True:
2
- try:
3
- reaction, user = await bot.wait_for("reaction_add", timeout=500, check=check)
4
- if str(reaction.emoji) == "▶️" and cur_page != pages:
5
- cur_page += 1
6
- await message.edit(embed=contents[cur_page - 1])
7
- await message.remove_reaction(reaction, user)
8
- elif str(reaction.emoji) == "◀️" and cur_page > 1:
9
- cur_page -= 1
10
- await message.edit(embed=contents[cur_page - 1])
11
- await message.remove_reaction(reaction, user)
12
- else:
13
- await message.remove_reaction(reaction, user)
14
-
15
- except asyncio.TimeoutError:
16
- await message.delete()
17
- break
18
- にしたらできました。
1
+ @b.command