回答編集履歴

2

追記

2020/08/11 09:37

投稿

Reply
Reply

スコア21

test CHANGED
@@ -13,3 +13,47 @@
13
13
  discord.utils.getについては
14
14
 
15
15
  [こちら](https://discordpy.readthedocs.io/en/latest/api.html#discord.utils.get)を見てください。
16
+
17
+
18
+
19
+ ### 追記
20
+
21
+ ```py
22
+
23
+ import discord
24
+
25
+ import random
26
+
27
+ from discord.ext import commands
28
+
29
+ from discord.utils import get
30
+
31
+
32
+
33
+ token = ""
34
+
35
+ bot = commands.Bot(command_prefix = '.')
36
+
37
+
38
+
39
+ @bot.event
40
+
41
+ async def on_ready():
42
+
43
+ print('Ready')
44
+
45
+
46
+
47
+ @bot.command(pass_context=True)
48
+
49
+ async def dm(ctx):
50
+
51
+ user = discord.utils.get(bot.users, id=609388801168769034)
52
+
53
+ await user.send('Hey guys! We have a gift for you!')
54
+
55
+
56
+
57
+ bot.run(token)
58
+
59
+ ```

1

追記

2020/08/11 09:37

投稿

Reply
Reply

スコア21

test CHANGED
@@ -6,4 +6,10 @@
6
6
 
7
7
  ```
8
8
 
9
- 動作テストはしていないですが、これでおそらくできると思います。
9
+ これでできると思います。
10
+
11
+
12
+
13
+ discord.utils.getについては
14
+
15
+ [こちら](https://discordpy.readthedocs.io/en/latest/api.html#discord.utils.get)を見てください。