質問編集履歴

3

コード変更

2021/07/31 07:55

投稿

gx1285
gx1285

スコア136

test CHANGED
File without changes
test CHANGED
@@ -10,9 +10,9 @@
10
10
 
11
11
  import discord
12
12
 
13
- from discord_slash import SlashCommand # Importing the newly installed library.
13
+ from discord_slash import SlashCommand
14
14
 
15
- from typing import Optional
15
+
16
16
 
17
17
 
18
18
 
@@ -30,7 +30,9 @@
30
30
 
31
31
 
32
32
 
33
- @slash.slash(name="serverinfo",description="serverinfo")
33
+ @slash.slash(name=serverinfo",
34
+
35
+ description="サーバーの情報を表示します")
34
36
 
35
37
  async def _serverinfo(ctx):
36
38
 
@@ -56,13 +58,13 @@
56
58
 
57
59
  embed.add_field(name="<:ten:858562663771668501>サーバー作成日(UTC)", value=guild.created_at, inline=False)
58
60
 
61
+ await message.channel.send(embed=embed)
62
+
59
63
  client.run("TOKEN")
60
64
 
61
65
  ```
62
66
 
63
- ###試したこと
64
67
 
65
- `await ctx.send(embed=embed)`の追加
66
68
 
67
69
  ### ツールのバージョン
68
70
 

2

誤字

2021/07/31 07:55

投稿

gx1285
gx1285

スコア136

test CHANGED
File without changes
test CHANGED
@@ -11,8 +11,6 @@
11
11
  import discord
12
12
 
13
13
  from discord_slash import SlashCommand # Importing the newly installed library.
14
-
15
- import asyncio
16
14
 
17
15
  from typing import Optional
18
16
 
@@ -34,7 +32,7 @@
34
32
 
35
33
  @slash.slash(name="serverinfo",description="serverinfo")
36
34
 
37
- async def _ping(ctx):
35
+ async def _serverinfo(ctx):
38
36
 
39
37
  guild = ctx.message.guild
40
38
 

1

全コード追加

2021/07/04 01:14

投稿

gx1285
gx1285

スコア136

test CHANGED
File without changes
test CHANGED
@@ -7,6 +7,30 @@
7
7
  ### 該当のソースコード
8
8
 
9
9
  ```python
10
+
11
+ import discord
12
+
13
+ from discord_slash import SlashCommand # Importing the newly installed library.
14
+
15
+ import asyncio
16
+
17
+ from typing import Optional
18
+
19
+
20
+
21
+ client = discord.Client(intents=discord.Intents.all())
22
+
23
+ slash = SlashCommand(client, sync_commands=True) # Declares slash commands through the client.
24
+
25
+
26
+
27
+ @client.event
28
+
29
+ async def on_ready():
30
+
31
+ print("Ready!")
32
+
33
+
10
34
 
11
35
  @slash.slash(name="serverinfo",description="serverinfo")
12
36
 
@@ -34,6 +58,8 @@
34
58
 
35
59
  embed.add_field(name="<:ten:858562663771668501>サーバー作成日(UTC)", value=guild.created_at, inline=False)
36
60
 
61
+ client.run("TOKEN")
62
+
37
63
  ```
38
64
 
39
65
  ###試したこと