質問編集履歴
2
コード直し
title
CHANGED
File without changes
|
body
CHANGED
@@ -41,6 +41,45 @@
|
|
41
41
|
サイトをあちこち回りました
|
42
42
|
が何をすればいいのか全く...
|
43
43
|
|
44
|
+
ですが/ping を実行すると/pongが返ってくるようにするコードを書き実行したところ
|
45
|
+
1回のみの反応でした。
|
46
|
+
多重ログインではないです
|
47
|
+
|
48
|
+
|
49
|
+
|
44
50
|
### 補足情報
|
45
51
|
|
46
|
-
pythonV3.8.1 ブランチrewrite
|
52
|
+
pythonV3.8.1 ブランチrewrite
|
53
|
+
|
54
|
+
###書き直したコード(追加あり)
|
55
|
+
```py
|
56
|
+
global ch_flag
|
57
|
+
ch_flag = True
|
58
|
+
@client.event
|
59
|
+
async def on_message(message):
|
60
|
+
if message.content.startswith('/open') and ch_flag == True:
|
61
|
+
ch_flag = False
|
62
|
+
category_id = xxxxxxxxxxxxxxxxx
|
63
|
+
category = message.guild.get_channel(category_id)
|
64
|
+
cmd_search = str(message.content)
|
65
|
+
ch_name = cmd_search[6:]
|
66
|
+
new_channel = await category.create_text_channel(name= ch_name)
|
67
|
+
reply = f'{new_channel.mention} を作成しました'
|
68
|
+
await message.channel.send(reply)
|
69
|
+
guild = message.guild
|
70
|
+
role = await guild.create_role(name=ch_name)
|
71
|
+
await new_channel.set_permissions(role,read_messages=True,send_messages=True)
|
72
|
+
reply2 = f'{role.mention} を作成しました'
|
73
|
+
await message.channel.send(reply2)
|
74
|
+
await message.channel.send('権限設定を行いました')
|
75
|
+
await asyncio.sleep(0.2)
|
76
|
+
ch_flag = True
|
77
|
+
category_id_2 = xxxxxxxxxxxxxxxxxxxxxxxx
|
78
|
+
category_2 = message.guild.get_channel(category_id_2)
|
79
|
+
new_channel_2 = await category_2.create_text_channel(name = ch_name + '用')
|
80
|
+
if message.content == "/ping":
|
81
|
+
await message.channel.send("pong!")
|
82
|
+
if message.author.bot:
|
83
|
+
return```
|
84
|
+
|
85
|
+
です
|
1
依頼通り直しましたすいません
title
CHANGED
File without changes
|
body
CHANGED
@@ -6,7 +6,6 @@
|
|
6
6
|
|
7
7
|
```
|
8
8
|
コードを実行した際にこのようになります。
|
9
|
-

|
10
9
|
チャンネルを一つだけ作成したいのですが3つ作られてしまう
|
11
10
|
実際には
|
12
11
|
#チャンネルをさくせいしました。
|
@@ -15,7 +14,7 @@
|
|
15
14
|
と返してほしいのですがね
|
16
15
|
|
17
16
|
```
|
18
|
-
|
17
|
+

|
19
18
|
### 該当のソースコード
|
20
19
|
|
21
20
|
```py
|
@@ -40,6 +39,7 @@
|
|
40
39
|
### 試したこと
|
41
40
|
|
42
41
|
サイトをあちこち回りました
|
42
|
+
が何をすればいいのか全く...
|
43
43
|
|
44
44
|
### 補足情報
|
45
45
|
|