質問編集履歴
2
誤字の修正と追記
title
CHANGED
|
File without changes
|
body
CHANGED
|
@@ -20,11 +20,15 @@
|
|
|
20
20
|
if message.content == "DM":
|
|
21
21
|
dm = await message.author.create_dm()
|
|
22
22
|
await dm.send("お知らせ")
|
|
23
|
+
client.run(TOKEN)
|
|
23
24
|
```
|
|
24
|
-
client.run(TOKEN)
|
|
25
25
|
|
|
26
26
|
環境
|
|
27
27
|
win10
|
|
28
28
|
anaconda3
|
|
29
29
|
Python 3.7.6
|
|
30
|
-
discord.py 1.3.3
|
|
30
|
+
discord.py 1.3.3
|
|
31
|
+
|
|
32
|
+
追記
|
|
33
|
+
プログラミング初心者でどうすればいいかわからず適当な質問をしてしまい申し訳ございません。
|
|
34
|
+
以降気を付けて質問いたします
|
1
コードの書き込み
title
CHANGED
|
File without changes
|
body
CHANGED
|
@@ -1,5 +1,28 @@
|
|
|
1
1
|
discord.pyでbotがサーバー内の人全員にDMを送ることってできますか?
|
|
2
|
+
個人にはおくれるのですが全員に送る方法がわかりません。
|
|
2
3
|
|
|
4
|
+
コード
|
|
5
|
+
```
|
|
6
|
+
import discord
|
|
7
|
+
|
|
8
|
+
TOKEN = ''
|
|
9
|
+
|
|
10
|
+
client = discord.Client()
|
|
11
|
+
|
|
12
|
+
@client.event
|
|
13
|
+
async def on_ready():
|
|
14
|
+
print('logged')
|
|
15
|
+
|
|
16
|
+
@client.event
|
|
17
|
+
async def on_message(message):
|
|
18
|
+
if message.author.bot:
|
|
19
|
+
return
|
|
20
|
+
if message.content == "DM":
|
|
21
|
+
dm = await message.author.create_dm()
|
|
22
|
+
await dm.send("お知らせ")
|
|
23
|
+
```
|
|
24
|
+
client.run(TOKEN)
|
|
25
|
+
|
|
3
26
|
環境
|
|
4
27
|
win10
|
|
5
28
|
anaconda3
|