質問編集履歴
15
VoiceStateについて調べましたがわかりませんでした 追記です。
test
CHANGED
File without changes
|
test
CHANGED
@@ -92,7 +92,7 @@
|
|
92
92
|
|
93
93
|
#追記2
|
94
94
|
|
95
|
-
|
95
|
+
```
|
96
96
|
|
97
97
|
import discord
|
98
98
|
|
14
VoiceStateについて調べましたがわかりませんでした 追記です。
test
CHANGED
File without changes
|
test
CHANGED
@@ -158,102 +158,98 @@
|
|
158
158
|
|
159
159
|
|
160
160
|
|
161
|
+
#エラー ※起動してボイチャに入って抜けて終わる動作です。
|
162
|
+
|
163
|
+
ボイスチャンネルで変化がありました
|
164
|
+
|
165
|
+
Ignoring exception in on_voice_state_update
|
166
|
+
|
167
|
+
Traceback (most recent call last):
|
168
|
+
|
169
|
+
File "C:\Program Files\Python39\lib\site-packages\discord\client.py", line 343, in _run_event
|
170
|
+
|
171
|
+
await coro(*args, **kwargs)
|
172
|
+
|
173
|
+
File "c:\Users\user\Desktop\nob\Virtual_currency_of_the_tool\noob.py", line 15, in on_voice_state_update
|
174
|
+
|
175
|
+
if((before.self_mute is not after.self_mute)
|
176
|
+
|
177
|
+
or (before.voice.self_deaf is not after.voice.self_deaf)):
|
178
|
+
|
179
|
+
AttributeError: 'VoiceState' object has no attribute 'voice'
|
180
|
+
|
181
|
+
ログインしました
|
182
|
+
|
183
|
+
ボイスチャンネルで変化がありました
|
184
|
+
|
185
|
+
Ignoring exception in on_voice_state_update
|
186
|
+
|
187
|
+
Traceback (most recent call last):
|
188
|
+
|
189
|
+
File "C:\Program Files\Python39\lib\site-packages\discord\client.py", line 343, in _run_event
|
190
|
+
|
191
|
+
await coro(*args, **kwargs)
|
192
|
+
|
193
|
+
File "c:\Users\user\Desktop\nob\Virtual_currency_of_the_tool\noob.py", line 15, in on_voice_state_update
|
194
|
+
|
195
|
+
if((before.self_mute is not after.self_mute)
|
196
|
+
|
197
|
+
or (before.voice.self_deaf is not after.voice.self_deaf)):
|
198
|
+
|
199
|
+
AttributeError: 'VoiceState' object has no attribute 'voice'
|
200
|
+
|
201
|
+
Exception ignored in: <function _ProactorBasePipeTransport.__del__ at 0x00000255F0F0ADC0>
|
202
|
+
|
203
|
+
Traceback (most recent call last):
|
204
|
+
|
205
|
+
File "C:\Program Files\Python39\lib\asyncio\proactor_events.py", line 116, in __del__
|
206
|
+
|
207
|
+
self.close()ボイスチャンネルで変化がありました
|
208
|
+
|
209
|
+
Ignoring exception in on_voice_state_update
|
210
|
+
|
211
|
+
Traceback (most recent call last):
|
212
|
+
|
213
|
+
File "C:\Program Files\Python39\lib\site-packages\discord\client.py", line 343, in _run_event
|
214
|
+
|
215
|
+
await coro(*args, **kwargs)
|
216
|
+
|
217
|
+
File "c:\Users\user\Desktop\nob\Virtual_currency_of_the_tool\noob.py", line 15, in on_voice_state_update
|
218
|
+
|
219
|
+
if((before.self_mute is not after.self_mute)
|
220
|
+
|
221
|
+
or (before.voice.self_deaf is not after.voice.self_deaf)):
|
222
|
+
|
223
|
+
AttributeError: 'VoiceState' object has no attribute 'voice'
|
224
|
+
|
225
|
+
ログインしました
|
226
|
+
|
227
|
+
ボイスチャンネルで変化がありました
|
228
|
+
|
229
|
+
Ignoring exception in on_voice_state_update
|
230
|
+
|
231
|
+
Traceback (most recent call last):
|
232
|
+
|
233
|
+
File "C:\Program Files\Python39\lib\site-packages\discord\client.py", line 343, in _run_event
|
234
|
+
|
235
|
+
await coro(*args, **kwargs)
|
236
|
+
|
237
|
+
File "c:\Users\user\Desktop\nob\Virtual_currency_of_the_tool\noob.py", line 15, in on_voice_state_update
|
238
|
+
|
239
|
+
if((before.self_mute is not after.self_mute)
|
240
|
+
|
241
|
+
or (before.voice.self_deaf is not after.voice.self_deaf)):
|
242
|
+
|
243
|
+
AttributeError: 'VoiceState' object has no attribute 'voice'
|
244
|
+
|
245
|
+
Exception ignored in: <function _ProactorBasePipeTransport.__del__ at 0x00000255F0F0ADC0>
|
246
|
+
|
247
|
+
Traceback (most recent call last):
|
248
|
+
|
249
|
+
File "C:\Program Files\Python39\lib\asyncio\proactor_events.py", line 116, in __del__
|
250
|
+
|
251
|
+
self.close()
|
252
|
+
|
253
|
+
コード
|
254
|
+
|
161
255
|
```
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
#エラー ※起動してボイチャに入って抜けて終わる動作です。
|
166
|
-
|
167
|
-
```ボイスチャンネルで変化がありました
|
168
|
-
|
169
|
-
Ignoring exception in on_voice_state_update
|
170
|
-
|
171
|
-
Traceback (most recent call last):
|
172
|
-
|
173
|
-
File "C:\Program Files\Python39\lib\site-packages\discord\client.py", line 343, in _run_event
|
174
|
-
|
175
|
-
await coro(*args, **kwargs)
|
176
|
-
|
177
|
-
File "c:\Users\user\Desktop\nob\Virtual_currency_of_the_tool\noob.py", line 15, in on_voice_state_update
|
178
|
-
|
179
|
-
if((before.self_mute is not after.self_mute)
|
180
|
-
|
181
|
-
or (before.voice.self_deaf is not after.voice.self_deaf)):
|
182
|
-
|
183
|
-
AttributeError: 'VoiceState' object has no attribute 'voice'
|
184
|
-
|
185
|
-
ログインしました
|
186
|
-
|
187
|
-
ボイスチャンネルで変化がありました
|
188
|
-
|
189
|
-
Ignoring exception in on_voice_state_update
|
190
|
-
|
191
|
-
Traceback (most recent call last):
|
192
|
-
|
193
|
-
File "C:\Program Files\Python39\lib\site-packages\discord\client.py", line 343, in _run_event
|
194
|
-
|
195
|
-
await coro(*args, **kwargs)
|
196
|
-
|
197
|
-
File "c:\Users\user\Desktop\nob\Virtual_currency_of_the_tool\noob.py", line 15, in on_voice_state_update
|
198
|
-
|
199
|
-
if((before.self_mute is not after.self_mute)
|
200
|
-
|
201
|
-
or (before.voice.self_deaf is not after.voice.self_deaf)):
|
202
|
-
|
203
|
-
AttributeError: 'VoiceState' object has no attribute 'voice'
|
204
|
-
|
205
|
-
Exception ignored in: <function _ProactorBasePipeTransport.__del__ at 0x00000255F0F0ADC0>
|
206
|
-
|
207
|
-
Traceback (most recent call last):
|
208
|
-
|
209
|
-
File "C:\Program Files\Python39\lib\asyncio\proactor_events.py", line 116, in __del__
|
210
|
-
|
211
|
-
self.close()ボイスチャンネルで変化がありました
|
212
|
-
|
213
|
-
Ignoring exception in on_voice_state_update
|
214
|
-
|
215
|
-
Traceback (most recent call last):
|
216
|
-
|
217
|
-
File "C:\Program Files\Python39\lib\site-packages\discord\client.py", line 343, in _run_event
|
218
|
-
|
219
|
-
await coro(*args, **kwargs)
|
220
|
-
|
221
|
-
File "c:\Users\user\Desktop\nob\Virtual_currency_of_the_tool\noob.py", line 15, in on_voice_state_update
|
222
|
-
|
223
|
-
if((before.self_mute is not after.self_mute)
|
224
|
-
|
225
|
-
or (before.voice.self_deaf is not after.voice.self_deaf)):
|
226
|
-
|
227
|
-
AttributeError: 'VoiceState' object has no attribute 'voice'
|
228
|
-
|
229
|
-
ログインしました
|
230
|
-
|
231
|
-
ボイスチャンネルで変化がありました
|
232
|
-
|
233
|
-
Ignoring exception in on_voice_state_update
|
234
|
-
|
235
|
-
Traceback (most recent call last):
|
236
|
-
|
237
|
-
File "C:\Program Files\Python39\lib\site-packages\discord\client.py", line 343, in _run_event
|
238
|
-
|
239
|
-
await coro(*args, **kwargs)
|
240
|
-
|
241
|
-
File "c:\Users\user\Desktop\nob\Virtual_currency_of_the_tool\noob.py", line 15, in on_voice_state_update
|
242
|
-
|
243
|
-
if((before.self_mute is not after.self_mute)
|
244
|
-
|
245
|
-
or (before.voice.self_deaf is not after.voice.self_deaf)):
|
246
|
-
|
247
|
-
AttributeError: 'VoiceState' object has no attribute 'voice'
|
248
|
-
|
249
|
-
Exception ignored in: <function _ProactorBasePipeTransport.__del__ at 0x00000255F0F0ADC0>
|
250
|
-
|
251
|
-
Traceback (most recent call last):
|
252
|
-
|
253
|
-
File "C:\Program Files\Python39\lib\asyncio\proactor_events.py", line 116, in __del__
|
254
|
-
|
255
|
-
self.close()
|
256
|
-
|
257
|
-
コード
|
258
|
-
|
259
|
-
```
|
13
VoiceStateについて調べましたがわかりませんでした 追記です。
test
CHANGED
File without changes
|
test
CHANGED
@@ -92,164 +92,168 @@
|
|
92
92
|
|
93
93
|
#追記2
|
94
94
|
|
95
|
+
コード```
|
96
|
+
|
97
|
+
import discord
|
98
|
+
|
99
|
+
import datetime
|
100
|
+
|
101
|
+
|
102
|
+
|
103
|
+
client = discord.Client()
|
104
|
+
|
105
|
+
pretime_dict = {}
|
106
|
+
|
107
|
+
|
108
|
+
|
109
|
+
@client.event
|
110
|
+
|
111
|
+
async def on_ready():
|
112
|
+
|
113
|
+
print('ログインしました')
|
114
|
+
|
115
|
+
|
116
|
+
|
117
|
+
@client.event
|
118
|
+
|
119
|
+
async def on_voice_state_update(member, before, after):
|
120
|
+
|
121
|
+
print("ボイスチャンネルで変化がありました")
|
122
|
+
|
123
|
+
|
124
|
+
|
125
|
+
if((before.self_mute is not after.self_mute) or (before.voice.self_deaf is not after.voice.self_deaf)):
|
126
|
+
|
127
|
+
print("ボイスチャンネルでミュート設定の変更がありました")
|
128
|
+
|
129
|
+
return
|
130
|
+
|
131
|
+
|
132
|
+
|
133
|
+
if(before.voice_channel is None):
|
134
|
+
|
135
|
+
pretime_dict[after.name] = datetime.datetime.now()
|
136
|
+
|
137
|
+
elif(after.voice_channel is None):
|
138
|
+
|
139
|
+
duration_time = pretime_dict[before.name] - datetime.datetime.now()
|
140
|
+
|
141
|
+
duration_time_adjust = int(duration_time.total_seconds()) * -1
|
142
|
+
|
143
|
+
|
144
|
+
|
145
|
+
reply_channel_name = "#Study-time"
|
146
|
+
|
147
|
+
reply_channel = [channel for channel in before.server.channels if channel.name == reply_channel_name][0]
|
148
|
+
|
149
|
+
reply_text = after.name + " が "+ before.voice_channel.name + " から抜けました。 通話時間:" + str(duration_time_adjust) +"秒"
|
150
|
+
|
151
|
+
|
152
|
+
|
153
|
+
await Client.send_message(reply_channel ,reply_text)
|
154
|
+
|
155
|
+
|
156
|
+
|
157
|
+
client.run("token")
|
158
|
+
|
159
|
+
|
160
|
+
|
161
|
+
```
|
162
|
+
|
163
|
+
|
164
|
+
|
165
|
+
#エラー ※起動してボイチャに入って抜けて終わる動作です。
|
166
|
+
|
167
|
+
```ボイスチャンネルで変化がありました
|
168
|
+
|
169
|
+
Ignoring exception in on_voice_state_update
|
170
|
+
|
171
|
+
Traceback (most recent call last):
|
172
|
+
|
173
|
+
File "C:\Program Files\Python39\lib\site-packages\discord\client.py", line 343, in _run_event
|
174
|
+
|
175
|
+
await coro(*args, **kwargs)
|
176
|
+
|
177
|
+
File "c:\Users\user\Desktop\nob\Virtual_currency_of_the_tool\noob.py", line 15, in on_voice_state_update
|
178
|
+
|
179
|
+
if((before.self_mute is not after.self_mute)
|
180
|
+
|
181
|
+
or (before.voice.self_deaf is not after.voice.self_deaf)):
|
182
|
+
|
183
|
+
AttributeError: 'VoiceState' object has no attribute 'voice'
|
184
|
+
|
185
|
+
ログインしました
|
186
|
+
|
187
|
+
ボイスチャンネルで変化がありました
|
188
|
+
|
189
|
+
Ignoring exception in on_voice_state_update
|
190
|
+
|
191
|
+
Traceback (most recent call last):
|
192
|
+
|
193
|
+
File "C:\Program Files\Python39\lib\site-packages\discord\client.py", line 343, in _run_event
|
194
|
+
|
195
|
+
await coro(*args, **kwargs)
|
196
|
+
|
197
|
+
File "c:\Users\user\Desktop\nob\Virtual_currency_of_the_tool\noob.py", line 15, in on_voice_state_update
|
198
|
+
|
199
|
+
if((before.self_mute is not after.self_mute)
|
200
|
+
|
201
|
+
or (before.voice.self_deaf is not after.voice.self_deaf)):
|
202
|
+
|
203
|
+
AttributeError: 'VoiceState' object has no attribute 'voice'
|
204
|
+
|
205
|
+
Exception ignored in: <function _ProactorBasePipeTransport.__del__ at 0x00000255F0F0ADC0>
|
206
|
+
|
207
|
+
Traceback (most recent call last):
|
208
|
+
|
209
|
+
File "C:\Program Files\Python39\lib\asyncio\proactor_events.py", line 116, in __del__
|
210
|
+
|
211
|
+
self.close()ボイスチャンネルで変化がありました
|
212
|
+
|
213
|
+
Ignoring exception in on_voice_state_update
|
214
|
+
|
215
|
+
Traceback (most recent call last):
|
216
|
+
|
217
|
+
File "C:\Program Files\Python39\lib\site-packages\discord\client.py", line 343, in _run_event
|
218
|
+
|
219
|
+
await coro(*args, **kwargs)
|
220
|
+
|
221
|
+
File "c:\Users\user\Desktop\nob\Virtual_currency_of_the_tool\noob.py", line 15, in on_voice_state_update
|
222
|
+
|
223
|
+
if((before.self_mute is not after.self_mute)
|
224
|
+
|
225
|
+
or (before.voice.self_deaf is not after.voice.self_deaf)):
|
226
|
+
|
227
|
+
AttributeError: 'VoiceState' object has no attribute 'voice'
|
228
|
+
|
229
|
+
ログインしました
|
230
|
+
|
231
|
+
ボイスチャンネルで変化がありました
|
232
|
+
|
233
|
+
Ignoring exception in on_voice_state_update
|
234
|
+
|
235
|
+
Traceback (most recent call last):
|
236
|
+
|
237
|
+
File "C:\Program Files\Python39\lib\site-packages\discord\client.py", line 343, in _run_event
|
238
|
+
|
239
|
+
await coro(*args, **kwargs)
|
240
|
+
|
241
|
+
File "c:\Users\user\Desktop\nob\Virtual_currency_of_the_tool\noob.py", line 15, in on_voice_state_update
|
242
|
+
|
243
|
+
if((before.self_mute is not after.self_mute)
|
244
|
+
|
245
|
+
or (before.voice.self_deaf is not after.voice.self_deaf)):
|
246
|
+
|
247
|
+
AttributeError: 'VoiceState' object has no attribute 'voice'
|
248
|
+
|
249
|
+
Exception ignored in: <function _ProactorBasePipeTransport.__del__ at 0x00000255F0F0ADC0>
|
250
|
+
|
251
|
+
Traceback (most recent call last):
|
252
|
+
|
253
|
+
File "C:\Program Files\Python39\lib\asyncio\proactor_events.py", line 116, in __del__
|
254
|
+
|
255
|
+
self.close()
|
256
|
+
|
95
257
|
コード
|
96
258
|
|
97
|
-
import discord
|
98
|
-
|
99
|
-
import datetime
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
client = discord.Client()
|
104
|
-
|
105
|
-
pretime_dict = {}
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
@client.event
|
110
|
-
|
111
|
-
async def on_ready():
|
112
|
-
|
113
|
-
print('ログインしました')
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
@client.event
|
118
|
-
|
119
|
-
async def on_voice_state_update(member, before, after):
|
120
|
-
|
121
|
-
print("ボイスチャンネルで変化がありました")
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
if((before.self_mute is not after.self_mute) or (before.voice.self_deaf is not after.voice.self_deaf)):
|
126
|
-
|
127
|
-
print("ボイスチャンネルでミュート設定の変更がありました")
|
128
|
-
|
129
|
-
return
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
if(before.voice_channel is None):
|
134
|
-
|
135
|
-
pretime_dict[after.name] = datetime.datetime.now()
|
136
|
-
|
137
|
-
elif(after.voice_channel is None):
|
138
|
-
|
139
|
-
duration_time = pretime_dict[before.name] - datetime.datetime.now()
|
140
|
-
|
141
|
-
duration_time_adjust = int(duration_time.total_seconds()) * -1
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
reply_channel_name = "#Study-time"
|
146
|
-
|
147
|
-
reply_channel = [channel for channel in before.server.channels if channel.name == reply_channel_name][0]
|
148
|
-
|
149
|
-
reply_text = after.name + " が "+ before.voice_channel.name + " から抜けました。 通話時間:" + str(duration_time_adjust) +"秒"
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
await Client.send_message(reply_channel ,reply_text)
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
client.run("token")
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
#エラー ※起動してボイチャに入って抜けて終わる動作です。
|
162
|
-
|
163
|
-
```ボイスチャンネルで変化がありました
|
164
|
-
|
165
|
-
Ignoring exception in on_voice_state_update
|
166
|
-
|
167
|
-
Traceback (most recent call last):
|
168
|
-
|
169
|
-
File "C:\Program Files\Python39\lib\site-packages\discord\client.py", line 343, in _run_event
|
170
|
-
|
171
|
-
await coro(*args, **kwargs)
|
172
|
-
|
173
|
-
File "c:\Users\user\Desktop\nob\Virtual_currency_of_the_tool\noob.py", line 15, in on_voice_state_update
|
174
|
-
|
175
|
-
if((before.self_mute is not after.self_mute)
|
176
|
-
|
177
|
-
or (before.voice.self_deaf is not after.voice.self_deaf)):
|
178
|
-
|
179
|
-
AttributeError: 'VoiceState' object has no attribute 'voice'
|
180
|
-
|
181
|
-
ログインしました
|
182
|
-
|
183
|
-
ボイスチャンネルで変化がありました
|
184
|
-
|
185
|
-
Ignoring exception in on_voice_state_update
|
186
|
-
|
187
|
-
Traceback (most recent call last):
|
188
|
-
|
189
|
-
File "C:\Program Files\Python39\lib\site-packages\discord\client.py", line 343, in _run_event
|
190
|
-
|
191
|
-
await coro(*args, **kwargs)
|
192
|
-
|
193
|
-
File "c:\Users\user\Desktop\nob\Virtual_currency_of_the_tool\noob.py", line 15, in on_voice_state_update
|
194
|
-
|
195
|
-
if((before.self_mute is not after.self_mute)
|
196
|
-
|
197
|
-
or (before.voice.self_deaf is not after.voice.self_deaf)):
|
198
|
-
|
199
|
-
AttributeError: 'VoiceState' object has no attribute 'voice'
|
200
|
-
|
201
|
-
Exception ignored in: <function _ProactorBasePipeTransport.__del__ at 0x00000255F0F0ADC0>
|
202
|
-
|
203
|
-
Traceback (most recent call last):
|
204
|
-
|
205
|
-
File "C:\Program Files\Python39\lib\asyncio\proactor_events.py", line 116, in __del__
|
206
|
-
|
207
|
-
self.close()ボイスチャンネルで変化がありました
|
208
|
-
|
209
|
-
Ignoring exception in on_voice_state_update
|
210
|
-
|
211
|
-
Traceback (most recent call last):
|
212
|
-
|
213
|
-
File "C:\Program Files\Python39\lib\site-packages\discord\client.py", line 343, in _run_event
|
214
|
-
|
215
|
-
await coro(*args, **kwargs)
|
216
|
-
|
217
|
-
File "c:\Users\user\Desktop\nob\Virtual_currency_of_the_tool\noob.py", line 15, in on_voice_state_update
|
218
|
-
|
219
|
-
if((before.self_mute is not after.self_mute)
|
220
|
-
|
221
|
-
or (before.voice.self_deaf is not after.voice.self_deaf)):
|
222
|
-
|
223
|
-
AttributeError: 'VoiceState' object has no attribute 'voice'
|
224
|
-
|
225
|
-
ログインしました
|
226
|
-
|
227
|
-
ボイスチャンネルで変化がありました
|
228
|
-
|
229
|
-
Ignoring exception in on_voice_state_update
|
230
|
-
|
231
|
-
Traceback (most recent call last):
|
232
|
-
|
233
|
-
File "C:\Program Files\Python39\lib\site-packages\discord\client.py", line 343, in _run_event
|
234
|
-
|
235
|
-
await coro(*args, **kwargs)
|
236
|
-
|
237
|
-
File "c:\Users\user\Desktop\nob\Virtual_currency_of_the_tool\noob.py", line 15, in on_voice_state_update
|
238
|
-
|
239
|
-
if((before.self_mute is not after.self_mute)
|
240
|
-
|
241
|
-
or (before.voice.self_deaf is not after.voice.self_deaf)):
|
242
|
-
|
243
|
-
AttributeError: 'VoiceState' object has no attribute 'voice'
|
244
|
-
|
245
|
-
Exception ignored in: <function _ProactorBasePipeTransport.__del__ at 0x00000255F0F0ADC0>
|
246
|
-
|
247
|
-
Traceback (most recent call last):
|
248
|
-
|
249
|
-
File "C:\Program Files\Python39\lib\asyncio\proactor_events.py", line 116, in __del__
|
250
|
-
|
251
|
-
self.close()
|
252
|
-
|
253
|
-
コード
|
254
|
-
|
255
259
|
```
|
12
VoiceStateについて調べましたがわかりませんでした 追記です。
test
CHANGED
File without changes
|
test
CHANGED
@@ -88,294 +88,168 @@
|
|
88
88
|
|
89
89
|
client.run("token")
|
90
90
|
|
91
|
+
|
92
|
+
|
93
|
+
#追記2
|
94
|
+
|
95
|
+
コード
|
96
|
+
|
97
|
+
import discord
|
98
|
+
|
99
|
+
import datetime
|
100
|
+
|
101
|
+
|
102
|
+
|
103
|
+
client = discord.Client()
|
104
|
+
|
105
|
+
pretime_dict = {}
|
106
|
+
|
107
|
+
|
108
|
+
|
91
|
-
|
109
|
+
@client.event
|
110
|
+
|
111
|
+
async def on_ready():
|
112
|
+
|
113
|
+
print('ログインしました')
|
114
|
+
|
115
|
+
|
116
|
+
|
117
|
+
@client.event
|
118
|
+
|
119
|
+
async def on_voice_state_update(member, before, after):
|
120
|
+
|
121
|
+
print("ボイスチャンネルで変化がありました")
|
122
|
+
|
123
|
+
|
124
|
+
|
125
|
+
if((before.self_mute is not after.self_mute) or (before.voice.self_deaf is not after.voice.self_deaf)):
|
126
|
+
|
127
|
+
print("ボイスチャンネルでミュート設定の変更がありました")
|
128
|
+
|
129
|
+
return
|
130
|
+
|
131
|
+
|
132
|
+
|
133
|
+
if(before.voice_channel is None):
|
134
|
+
|
135
|
+
pretime_dict[after.name] = datetime.datetime.now()
|
136
|
+
|
137
|
+
elif(after.voice_channel is None):
|
138
|
+
|
139
|
+
duration_time = pretime_dict[before.name] - datetime.datetime.now()
|
140
|
+
|
141
|
+
duration_time_adjust = int(duration_time.total_seconds()) * -1
|
142
|
+
|
143
|
+
|
144
|
+
|
145
|
+
reply_channel_name = "#Study-time"
|
146
|
+
|
147
|
+
reply_channel = [channel for channel in before.server.channels if channel.name == reply_channel_name][0]
|
148
|
+
|
149
|
+
reply_text = after.name + " が "+ before.voice_channel.name + " から抜けました。 通話時間:" + str(duration_time_adjust) +"秒"
|
150
|
+
|
151
|
+
|
152
|
+
|
153
|
+
await Client.send_message(reply_channel ,reply_text)
|
154
|
+
|
155
|
+
|
156
|
+
|
157
|
+
client.run("token")
|
158
|
+
|
159
|
+
|
160
|
+
|
161
|
+
#エラー ※起動してボイチャに入って抜けて終わる動作です。
|
162
|
+
|
163
|
+
```ボイスチャンネルで変化がありました
|
164
|
+
|
165
|
+
Ignoring exception in on_voice_state_update
|
166
|
+
|
167
|
+
Traceback (most recent call last):
|
168
|
+
|
169
|
+
File "C:\Program Files\Python39\lib\site-packages\discord\client.py", line 343, in _run_event
|
170
|
+
|
171
|
+
await coro(*args, **kwargs)
|
172
|
+
|
173
|
+
File "c:\Users\user\Desktop\nob\Virtual_currency_of_the_tool\noob.py", line 15, in on_voice_state_update
|
174
|
+
|
175
|
+
if((before.self_mute is not after.self_mute)
|
176
|
+
|
177
|
+
or (before.voice.self_deaf is not after.voice.self_deaf)):
|
178
|
+
|
179
|
+
AttributeError: 'VoiceState' object has no attribute 'voice'
|
92
180
|
|
93
181
|
ログインしました
|
94
182
|
|
95
183
|
ボイスチャンネルで変化がありました
|
96
184
|
|
97
|
-
Ignoring exception in on_voice_state_update
|
185
|
+
Ignoring exception in on_voice_state_update
|
98
|
-
|
186
|
+
|
99
|
-
Traceback (most recent call last):
|
187
|
+
Traceback (most recent call last):
|
100
|
-
|
188
|
+
|
101
|
-
File "C:\Program Files\Python39\lib\site-packages\discord\client.py", line 343, in
|
189
|
+
File "C:\Program Files\Python39\lib\site-packages\discord\client.py", line 343, in _run_event
|
102
|
-
|
103
|
-
|
190
|
+
|
104
|
-
|
105
|
-
await coro(*args, **kwargs)
|
191
|
+
await coro(*args, **kwargs)
|
106
|
-
|
192
|
+
|
107
|
-
File "
|
193
|
+
File "c:\Users\user\Desktop\nob\Virtual_currency_of_the_tool\noob.py", line 15, in on_voice_state_update
|
108
|
-
|
194
|
+
|
109
|
-
o
|
195
|
+
if((before.self_mute is not after.self_mute)
|
110
|
-
|
196
|
+
|
111
|
-
|
197
|
+
or (before.voice.self_deaf is not after.voice.self_deaf)):
|
112
|
-
|
198
|
+
|
113
|
-
AttributeError: 'VoiceState' object has no attribute 'voice'
|
199
|
+
AttributeError: 'VoiceState' object has no attribute 'voice'
|
200
|
+
|
201
|
+
Exception ignored in: <function _ProactorBasePipeTransport.__del__ at 0x00000255F0F0ADC0>
|
202
|
+
|
203
|
+
Traceback (most recent call last):
|
204
|
+
|
205
|
+
File "C:\Program Files\Python39\lib\asyncio\proactor_events.py", line 116, in __del__
|
206
|
+
|
207
|
+
self.close()ボイスチャンネルで変化がありました
|
208
|
+
|
209
|
+
Ignoring exception in on_voice_state_update
|
210
|
+
|
211
|
+
Traceback (most recent call last):
|
212
|
+
|
213
|
+
File "C:\Program Files\Python39\lib\site-packages\discord\client.py", line 343, in _run_event
|
214
|
+
|
215
|
+
await coro(*args, **kwargs)
|
216
|
+
|
217
|
+
File "c:\Users\user\Desktop\nob\Virtual_currency_of_the_tool\noob.py", line 15, in on_voice_state_update
|
218
|
+
|
219
|
+
if((before.self_mute is not after.self_mute)
|
220
|
+
|
221
|
+
or (before.voice.self_deaf is not after.voice.self_deaf)):
|
222
|
+
|
223
|
+
AttributeError: 'VoiceState' object has no attribute 'voice'
|
224
|
+
|
225
|
+
ログインしました
|
114
226
|
|
115
227
|
ボイスチャンネルで変化がありました
|
116
228
|
|
117
|
-
Ignoring exception in on_voice_state_update
|
229
|
+
Ignoring exception in on_voice_state_update
|
118
|
-
|
230
|
+
|
119
|
-
Traceback (most recent call last):
|
231
|
+
Traceback (most recent call last):
|
120
|
-
|
232
|
+
|
121
|
-
File "C:\Program Files\Python39\lib\site-packages\discord\client.py", line 343, in
|
233
|
+
File "C:\Program Files\Python39\lib\site-packages\discord\client.py", line 343, in _run_event
|
122
|
-
|
123
|
-
|
234
|
+
|
124
|
-
|
125
|
-
await coro(*args, **kwargs)
|
235
|
+
await coro(*args, **kwargs)
|
126
|
-
|
236
|
+
|
127
|
-
File "
|
237
|
+
File "c:\Users\user\Desktop\nob\Virtual_currency_of_the_tool\noob.py", line 15, in on_voice_state_update
|
128
|
-
|
238
|
+
|
129
|
-
o
|
239
|
+
if((before.self_mute is not after.self_mute)
|
130
|
-
|
240
|
+
|
131
|
-
|
241
|
+
or (before.voice.self_deaf is not after.voice.self_deaf)):
|
132
|
-
|
242
|
+
|
133
|
-
AttributeError: 'VoiceState' object has no attribute 'voice'
|
243
|
+
AttributeError: 'VoiceState' object has no attribute 'voice'
|
134
|
-
|
244
|
+
|
135
|
-
Exception ignored in: <function _ProactorBasePipeTransport.__del__ at 0x00000
|
245
|
+
Exception ignored in: <function _ProactorBasePipeTransport.__del__ at 0x00000255F0F0ADC0>
|
136
246
|
|
137
247
|
Traceback (most recent call last):
|
138
248
|
|
139
249
|
File "C:\Program Files\Python39\lib\asyncio\proactor_events.py", line 116, in __del__
|
140
250
|
|
141
|
-
File "C:\Program Files\Python39\lib\asyncio\proactor_events.py", line 108, in close
|
142
|
-
|
143
|
-
File "C:\Program Files\Python39\lib\asyncio\base_events.py", line 746, in call_soon
|
144
|
-
|
145
|
-
File "C:\Program Files\Python39\lib\asyncio\base_events.py", line 510, in _check_closed
|
146
|
-
|
147
|
-
RuntimeError: Event loop is closed。
|
148
|
-
|
149
|
-
やりたいこと
|
150
|
-
|
151
|
-
エラーの解決法を知りたい。
|
152
|
-
|
153
|
-
#追記2
|
154
|
-
|
155
|
-
#コード
|
156
|
-
|
157
|
-
```import discord
|
158
|
-
|
159
|
-
import datetime
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
client = discord.Client()
|
164
|
-
|
165
|
-
pretime_dict = {}
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
251
|
+
self.close()
|
170
|
-
|
171
|
-
async def on_ready():
|
172
|
-
|
173
|
-
print('ログインしました')
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
@client.event
|
178
|
-
|
179
|
-
async def on_voice_state_update(member, before, after):
|
180
|
-
|
181
|
-
print("ボイスチャンネルで変化がありました")
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
if((before.self_mute is not after.self_mute) or (before.voice.self_deaf is not after.voice.self_deaf)):
|
186
|
-
|
187
|
-
print("ボイスチャンネルでミュート設定の変更がありました")
|
188
|
-
|
189
|
-
return
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
if(before.voice_channel is None):
|
194
|
-
|
195
|
-
pretime_dict[after.name] = datetime.datetime.now()
|
196
|
-
|
197
|
-
elif(after.voice_channel is None):
|
198
|
-
|
199
|
-
duration_time = pretime_dict[before.name] - datetime.datetime.now()
|
200
|
-
|
201
|
-
duration_time_adjust = int(duration_time.total_seconds()) * -1
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
reply_channel_name = "#Study-time"
|
206
|
-
|
207
|
-
reply_channel = [channel for channel in before.server.channels if channel.name == reply_channel_name][0]
|
208
|
-
|
209
|
-
reply_text = after.name + " が "+ before.voice_channel.name + " から抜けました。 通話時間:" + str(duration_time_adjust) +"秒"
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
await Client.send_message(reply_channel ,reply_text)
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
client.run("token")
|
218
252
|
|
219
253
|
コード
|
220
254
|
|
221
255
|
```
|
222
|
-
|
223
|
-
#エラーがこんなふうになりました。
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
if(before.voice_channel is None):
|
228
|
-
|
229
|
-
^
|
230
|
-
|
231
|
-
IndentationError: unindent does not match any outer indentation level
|
232
|
-
|
233
|
-
```
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
#追記2
|
238
|
-
|
239
|
-
コード
|
240
|
-
|
241
|
-
import discord
|
242
|
-
|
243
|
-
import datetime
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
client = discord.Client()
|
248
|
-
|
249
|
-
pretime_dict = {}
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
@client.event
|
254
|
-
|
255
|
-
async def on_ready():
|
256
|
-
|
257
|
-
print('ログインしました')
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
@client.event
|
262
|
-
|
263
|
-
async def on_voice_state_update(member, before, after):
|
264
|
-
|
265
|
-
print("ボイスチャンネルで変化がありました")
|
266
|
-
|
267
|
-
|
268
|
-
|
269
|
-
if((before.self_mute is not after.self_mute) or (before.voice.self_deaf is not after.voice.self_deaf)):
|
270
|
-
|
271
|
-
print("ボイスチャンネルでミュート設定の変更がありました")
|
272
|
-
|
273
|
-
return
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
if(before.voice_channel is None):
|
278
|
-
|
279
|
-
pretime_dict[after.name] = datetime.datetime.now()
|
280
|
-
|
281
|
-
elif(after.voice_channel is None):
|
282
|
-
|
283
|
-
duration_time = pretime_dict[before.name] - datetime.datetime.now()
|
284
|
-
|
285
|
-
duration_time_adjust = int(duration_time.total_seconds()) * -1
|
286
|
-
|
287
|
-
|
288
|
-
|
289
|
-
reply_channel_name = "#Study-time"
|
290
|
-
|
291
|
-
reply_channel = [channel for channel in before.server.channels if channel.name == reply_channel_name][0]
|
292
|
-
|
293
|
-
reply_text = after.name + " が "+ before.voice_channel.name + " から抜けました。 通話時間:" + str(duration_time_adjust) +"秒"
|
294
|
-
|
295
|
-
|
296
|
-
|
297
|
-
await Client.send_message(reply_channel ,reply_text)
|
298
|
-
|
299
|
-
|
300
|
-
|
301
|
-
client.run("token")
|
302
|
-
|
303
|
-
|
304
|
-
|
305
|
-
#エラー ※起動してボイチャに入って抜けて終わる動作です。
|
306
|
-
|
307
|
-
```ボイスチャンネルで変化がありました
|
308
|
-
|
309
|
-
Ignoring exception in on_voice_state_update
|
310
|
-
|
311
|
-
Traceback (most recent call last):
|
312
|
-
|
313
|
-
File "C:\Program Files\Python39\lib\site-packages\discord\client.py", line 343, in _run_event
|
314
|
-
|
315
|
-
await coro(*args, **kwargs)
|
316
|
-
|
317
|
-
File "c:\Users\user\Desktop\nob\Virtual_currency_of_the_tool\noob.py", line 15, in on_voice_state_update
|
318
|
-
|
319
|
-
if((before.self_mute is not after.self_mute)
|
320
|
-
|
321
|
-
or (before.voice.self_deaf is not after.voice.self_deaf)):
|
322
|
-
|
323
|
-
AttributeError: 'VoiceState' object has no attribute 'voice'
|
324
|
-
|
325
|
-
ログインしました
|
326
|
-
|
327
|
-
ボイスチャンネルで変化がありました
|
328
|
-
|
329
|
-
Ignoring exception in on_voice_state_update
|
330
|
-
|
331
|
-
Traceback (most recent call last):
|
332
|
-
|
333
|
-
File "C:\Program Files\Python39\lib\site-packages\discord\client.py", line 343, in _run_event
|
334
|
-
|
335
|
-
await coro(*args, **kwargs)
|
336
|
-
|
337
|
-
File "c:\Users\user\Desktop\nob\Virtual_currency_of_the_tool\noob.py", line 15, in on_voice_state_update
|
338
|
-
|
339
|
-
if((before.self_mute is not after.self_mute)
|
340
|
-
|
341
|
-
or (before.voice.self_deaf is not after.voice.self_deaf)):
|
342
|
-
|
343
|
-
AttributeError: 'VoiceState' object has no attribute 'voice'
|
344
|
-
|
345
|
-
Exception ignored in: <function _ProactorBasePipeTransport.__del__ at 0x00000255F0F0ADC0>
|
346
|
-
|
347
|
-
Traceback (most recent call last):
|
348
|
-
|
349
|
-
File "C:\Program Files\Python39\lib\asyncio\proactor_events.py", line 116, in __del__
|
350
|
-
|
351
|
-
self.close()
|
352
|
-
|
353
|
-
File "C:\Program Files\Python39\lib\asyncio\proactor_events.py", line 108, in close
|
354
|
-
|
355
|
-
self._loop.call_soon(self._call_connection_lost, None)
|
356
|
-
|
357
|
-
File "C:\Program Files\Python39\lib\asyncio\base_events.py", line 746, in call_soon
|
358
|
-
|
359
|
-
self._check_closed()
|
360
|
-
|
361
|
-
File "C:\Program Files\Python39\lib\asyncio\base_events.py", line 510, in _check_closed
|
362
|
-
|
363
|
-
raise RuntimeError('Event loop is closed')
|
364
|
-
|
365
|
-
RuntimeError: Event loop is closed
|
366
|
-
|
367
|
-
Exception ignored in: <function _ProactorBasePipeTransport.__del__ at 0x00000255F0F0ADC0>
|
368
|
-
|
369
|
-
Traceback (most recent call last):
|
370
|
-
|
371
|
-
File "C:\Program Files\Python39\lib\asyncio\proactor_events.py", line 116, in __del__
|
372
|
-
|
373
|
-
File "C:\Program Files\Python39\lib\asyncio\proactor_events.py", line 108, in close
|
374
|
-
|
375
|
-
File "C:\Program Files\Python39\lib\asyncio\base_events.py", line 746, in call_soon
|
376
|
-
|
377
|
-
File "C:\Program Files\Python39\lib\asyncio\base_events.py", line 510, in _check_closed
|
378
|
-
|
379
|
-
RuntimeError: Event loop is closed
|
380
|
-
|
381
|
-
```
|
11
VoiceStateについて調べましたがわかりませんでした 追記です。
test
CHANGED
File without changes
|
test
CHANGED
@@ -150,13 +150,11 @@
|
|
150
150
|
|
151
151
|
エラーの解決法を知りたい。
|
152
152
|
|
153
|
-
#追記
|
153
|
+
#追記2
|
154
154
|
|
155
155
|
#コード
|
156
156
|
|
157
|
-
|
158
|
-
|
159
|
-
```
|
157
|
+
```import discord
|
160
158
|
|
161
159
|
import datetime
|
162
160
|
|
@@ -180,27 +178,27 @@
|
|
180
178
|
|
181
179
|
async def on_voice_state_update(member, before, after):
|
182
180
|
|
183
|
-
print("ボイスチャンネルで変化がありました")
|
181
|
+
print("ボイスチャンネルで変化がありました")
|
184
|
-
|
185
|
-
|
186
|
-
|
182
|
+
|
183
|
+
|
184
|
+
|
187
|
-
if((before.self_mute is not after.self_mute) or (before.voice.self_deaf is not after.voice.self_deaf)):
|
185
|
+
if((before.self_mute is not after.self_mute) or (before.voice.self_deaf is not after.voice.self_deaf)):
|
188
|
-
|
186
|
+
|
189
|
-
print("ボイスチャンネルでミュート設定の変更がありました")
|
187
|
+
print("ボイスチャンネルでミュート設定の変更がありました")
|
190
|
-
|
188
|
+
|
191
|
-
return
|
189
|
+
return
|
192
|
-
|
193
|
-
|
194
|
-
|
190
|
+
|
191
|
+
|
192
|
+
|
195
|
-
if(before.voice_channel is None):
|
193
|
+
if(before.voice_channel is None):
|
196
|
-
|
194
|
+
|
197
|
-
pretime_dict[after.name] = datetime.datetime.now()
|
195
|
+
pretime_dict[after.name] = datetime.datetime.now()
|
198
|
-
|
196
|
+
|
199
|
-
elif(after.voice_channel is None):
|
197
|
+
elif(after.voice_channel is None):
|
200
|
-
|
198
|
+
|
201
|
-
duration_time = pretime_dict[before.name] - datetime.datetime.now()
|
199
|
+
duration_time = pretime_dict[before.name] - datetime.datetime.now()
|
202
|
-
|
200
|
+
|
203
|
-
duration_time_adjust = int(duration_time.total_seconds()) * -1
|
201
|
+
duration_time_adjust = int(duration_time.total_seconds()) * -1
|
204
202
|
|
205
203
|
|
206
204
|
|
@@ -212,11 +210,15 @@
|
|
212
210
|
|
213
211
|
|
214
212
|
|
215
|
-
await
|
213
|
+
await Client.send_message(reply_channel ,reply_text)
|
216
|
-
|
217
|
-
|
218
|
-
|
214
|
+
|
215
|
+
|
216
|
+
|
219
|
-
client.run("token")
|
217
|
+
client.run("token")
|
218
|
+
|
219
|
+
コード
|
220
|
+
|
221
|
+
```
|
220
222
|
|
221
223
|
#エラーがこんなふうになりました。
|
222
224
|
|
@@ -229,3 +231,151 @@
|
|
229
231
|
IndentationError: unindent does not match any outer indentation level
|
230
232
|
|
231
233
|
```
|
234
|
+
|
235
|
+
|
236
|
+
|
237
|
+
#追記2
|
238
|
+
|
239
|
+
コード
|
240
|
+
|
241
|
+
import discord
|
242
|
+
|
243
|
+
import datetime
|
244
|
+
|
245
|
+
|
246
|
+
|
247
|
+
client = discord.Client()
|
248
|
+
|
249
|
+
pretime_dict = {}
|
250
|
+
|
251
|
+
|
252
|
+
|
253
|
+
@client.event
|
254
|
+
|
255
|
+
async def on_ready():
|
256
|
+
|
257
|
+
print('ログインしました')
|
258
|
+
|
259
|
+
|
260
|
+
|
261
|
+
@client.event
|
262
|
+
|
263
|
+
async def on_voice_state_update(member, before, after):
|
264
|
+
|
265
|
+
print("ボイスチャンネルで変化がありました")
|
266
|
+
|
267
|
+
|
268
|
+
|
269
|
+
if((before.self_mute is not after.self_mute) or (before.voice.self_deaf is not after.voice.self_deaf)):
|
270
|
+
|
271
|
+
print("ボイスチャンネルでミュート設定の変更がありました")
|
272
|
+
|
273
|
+
return
|
274
|
+
|
275
|
+
|
276
|
+
|
277
|
+
if(before.voice_channel is None):
|
278
|
+
|
279
|
+
pretime_dict[after.name] = datetime.datetime.now()
|
280
|
+
|
281
|
+
elif(after.voice_channel is None):
|
282
|
+
|
283
|
+
duration_time = pretime_dict[before.name] - datetime.datetime.now()
|
284
|
+
|
285
|
+
duration_time_adjust = int(duration_time.total_seconds()) * -1
|
286
|
+
|
287
|
+
|
288
|
+
|
289
|
+
reply_channel_name = "#Study-time"
|
290
|
+
|
291
|
+
reply_channel = [channel for channel in before.server.channels if channel.name == reply_channel_name][0]
|
292
|
+
|
293
|
+
reply_text = after.name + " が "+ before.voice_channel.name + " から抜けました。 通話時間:" + str(duration_time_adjust) +"秒"
|
294
|
+
|
295
|
+
|
296
|
+
|
297
|
+
await Client.send_message(reply_channel ,reply_text)
|
298
|
+
|
299
|
+
|
300
|
+
|
301
|
+
client.run("token")
|
302
|
+
|
303
|
+
|
304
|
+
|
305
|
+
#エラー ※起動してボイチャに入って抜けて終わる動作です。
|
306
|
+
|
307
|
+
```ボイスチャンネルで変化がありました
|
308
|
+
|
309
|
+
Ignoring exception in on_voice_state_update
|
310
|
+
|
311
|
+
Traceback (most recent call last):
|
312
|
+
|
313
|
+
File "C:\Program Files\Python39\lib\site-packages\discord\client.py", line 343, in _run_event
|
314
|
+
|
315
|
+
await coro(*args, **kwargs)
|
316
|
+
|
317
|
+
File "c:\Users\user\Desktop\nob\Virtual_currency_of_the_tool\noob.py", line 15, in on_voice_state_update
|
318
|
+
|
319
|
+
if((before.self_mute is not after.self_mute)
|
320
|
+
|
321
|
+
or (before.voice.self_deaf is not after.voice.self_deaf)):
|
322
|
+
|
323
|
+
AttributeError: 'VoiceState' object has no attribute 'voice'
|
324
|
+
|
325
|
+
ログインしました
|
326
|
+
|
327
|
+
ボイスチャンネルで変化がありました
|
328
|
+
|
329
|
+
Ignoring exception in on_voice_state_update
|
330
|
+
|
331
|
+
Traceback (most recent call last):
|
332
|
+
|
333
|
+
File "C:\Program Files\Python39\lib\site-packages\discord\client.py", line 343, in _run_event
|
334
|
+
|
335
|
+
await coro(*args, **kwargs)
|
336
|
+
|
337
|
+
File "c:\Users\user\Desktop\nob\Virtual_currency_of_the_tool\noob.py", line 15, in on_voice_state_update
|
338
|
+
|
339
|
+
if((before.self_mute is not after.self_mute)
|
340
|
+
|
341
|
+
or (before.voice.self_deaf is not after.voice.self_deaf)):
|
342
|
+
|
343
|
+
AttributeError: 'VoiceState' object has no attribute 'voice'
|
344
|
+
|
345
|
+
Exception ignored in: <function _ProactorBasePipeTransport.__del__ at 0x00000255F0F0ADC0>
|
346
|
+
|
347
|
+
Traceback (most recent call last):
|
348
|
+
|
349
|
+
File "C:\Program Files\Python39\lib\asyncio\proactor_events.py", line 116, in __del__
|
350
|
+
|
351
|
+
self.close()
|
352
|
+
|
353
|
+
File "C:\Program Files\Python39\lib\asyncio\proactor_events.py", line 108, in close
|
354
|
+
|
355
|
+
self._loop.call_soon(self._call_connection_lost, None)
|
356
|
+
|
357
|
+
File "C:\Program Files\Python39\lib\asyncio\base_events.py", line 746, in call_soon
|
358
|
+
|
359
|
+
self._check_closed()
|
360
|
+
|
361
|
+
File "C:\Program Files\Python39\lib\asyncio\base_events.py", line 510, in _check_closed
|
362
|
+
|
363
|
+
raise RuntimeError('Event loop is closed')
|
364
|
+
|
365
|
+
RuntimeError: Event loop is closed
|
366
|
+
|
367
|
+
Exception ignored in: <function _ProactorBasePipeTransport.__del__ at 0x00000255F0F0ADC0>
|
368
|
+
|
369
|
+
Traceback (most recent call last):
|
370
|
+
|
371
|
+
File "C:\Program Files\Python39\lib\asyncio\proactor_events.py", line 116, in __del__
|
372
|
+
|
373
|
+
File "C:\Program Files\Python39\lib\asyncio\proactor_events.py", line 108, in close
|
374
|
+
|
375
|
+
File "C:\Program Files\Python39\lib\asyncio\base_events.py", line 746, in call_soon
|
376
|
+
|
377
|
+
File "C:\Program Files\Python39\lib\asyncio\base_events.py", line 510, in _check_closed
|
378
|
+
|
379
|
+
RuntimeError: Event loop is closed
|
380
|
+
|
381
|
+
```
|
10
チャンネル名に#をつけました コードも少々変更
test
CHANGED
File without changes
|
test
CHANGED
@@ -154,7 +154,9 @@
|
|
154
154
|
|
155
155
|
#コード
|
156
156
|
|
157
|
+
|
158
|
+
|
157
|
-
` import discord
|
159
|
+
``` import discord
|
158
160
|
|
159
161
|
import datetime
|
160
162
|
|
@@ -214,14 +216,16 @@
|
|
214
216
|
|
215
217
|
|
216
218
|
|
217
|
-
client.run("token")
|
219
|
+
client.run("token")
|
218
220
|
|
219
221
|
#エラーがこんなふうになりました。
|
220
222
|
|
221
223
|
|
222
224
|
|
223
|
-
|
225
|
+
if(before.voice_channel is None):
|
224
226
|
|
225
227
|
^
|
226
228
|
|
227
|
-
IndentationError: unindent does not match any outer indentation level
|
229
|
+
IndentationError: unindent does not match any outer indentation level
|
230
|
+
|
231
|
+
```
|
9
チャンネル名に#をつけました コードも少々変更
test
CHANGED
File without changes
|
test
CHANGED
@@ -154,7 +154,7 @@
|
|
154
154
|
|
155
155
|
#コード
|
156
156
|
|
157
|
-
`
|
157
|
+
` import discord
|
158
158
|
|
159
159
|
import datetime
|
160
160
|
|
@@ -214,7 +214,7 @@
|
|
214
214
|
|
215
215
|
|
216
216
|
|
217
|
-
client.run("token")`
|
217
|
+
client.run("token") `
|
218
218
|
|
219
219
|
#エラーがこんなふうになりました。
|
220
220
|
|
8
チャンネル名に#をつけました コードも少々変更
test
CHANGED
File without changes
|
test
CHANGED
@@ -220,8 +220,8 @@
|
|
220
220
|
|
221
221
|
|
222
222
|
|
223
|
-
`
|
223
|
+
` if(before.voice_channel is None):
|
224
224
|
|
225
225
|
^
|
226
226
|
|
227
|
-
IndentationError: unindent does not match any outer indentation level `
|
227
|
+
IndentationError: unindent does not match any outer indentation level `
|
7
チャンネル名に#をつけました コードも少々変更
test
CHANGED
File without changes
|
test
CHANGED
@@ -218,8 +218,10 @@
|
|
218
218
|
|
219
219
|
#エラーがこんなふうになりました。
|
220
220
|
|
221
|
+
|
222
|
+
|
221
223
|
``` if(before.voice_channel is None):
|
222
224
|
|
223
225
|
^
|
224
226
|
|
225
|
-
IndentationError: unindent does not match any outer indentation level```
|
227
|
+
IndentationError: unindent does not match any outer indentation level ```
|
6
チャンネル名に#をつけました コードも少々変更
test
CHANGED
File without changes
|
test
CHANGED
@@ -154,7 +154,7 @@
|
|
154
154
|
|
155
155
|
#コード
|
156
156
|
|
157
|
-
```import discord
|
157
|
+
``` import discord
|
158
158
|
|
159
159
|
import datetime
|
160
160
|
|
5
チャンネル名に#をつけました コードも少々変更
test
CHANGED
File without changes
|
test
CHANGED
@@ -154,7 +154,7 @@
|
|
154
154
|
|
155
155
|
#コード
|
156
156
|
|
157
|
-
import discord
|
157
|
+
```import discord
|
158
158
|
|
159
159
|
import datetime
|
160
160
|
|
@@ -214,7 +214,7 @@
|
|
214
214
|
|
215
215
|
|
216
216
|
|
217
|
-
client.run("token")
|
217
|
+
client.run("token")```
|
218
218
|
|
219
219
|
#エラーがこんなふうになりました。
|
220
220
|
|
4
チャンネル名に#をつけました コードも少々変更
test
CHANGED
File without changes
|
test
CHANGED
@@ -218,9 +218,7 @@
|
|
218
218
|
|
219
219
|
#エラーがこんなふうになりました。
|
220
220
|
|
221
|
-
``` File "c:\Users\user\Desktop\nob\Virtual_currency_of_the_tool\noob.py", line 19
|
222
|
-
|
223
|
-
if(before.voice_channel is None):
|
221
|
+
``` if(before.voice_channel is None):
|
224
222
|
|
225
223
|
^
|
226
224
|
|
3
チャンネル名に#をつけました コードも少々変更
test
CHANGED
File without changes
|
test
CHANGED
@@ -218,10 +218,10 @@
|
|
218
218
|
|
219
219
|
#エラーがこんなふうになりました。
|
220
220
|
|
221
|
-
File "c:\Users\user\Desktop\nob\Virtual_currency_of_the_tool\noob.py", line 19
|
221
|
+
``` File "c:\Users\user\Desktop\nob\Virtual_currency_of_the_tool\noob.py", line 19
|
222
222
|
|
223
223
|
if(before.voice_channel is None):
|
224
224
|
|
225
225
|
^
|
226
226
|
|
227
|
-
IndentationError: unindent does not match any outer indentation level
|
227
|
+
IndentationError: unindent does not match any outer indentation level```
|
2
チャンネル名に#をつけました コードも少々変更
test
CHANGED
File without changes
|
test
CHANGED
@@ -149,3 +149,79 @@
|
|
149
149
|
やりたいこと
|
150
150
|
|
151
151
|
エラーの解決法を知りたい。
|
152
|
+
|
153
|
+
#追記
|
154
|
+
|
155
|
+
#コード
|
156
|
+
|
157
|
+
import discord
|
158
|
+
|
159
|
+
import datetime
|
160
|
+
|
161
|
+
|
162
|
+
|
163
|
+
client = discord.Client()
|
164
|
+
|
165
|
+
pretime_dict = {}
|
166
|
+
|
167
|
+
|
168
|
+
|
169
|
+
@client.event
|
170
|
+
|
171
|
+
async def on_ready():
|
172
|
+
|
173
|
+
print('ログインしました')
|
174
|
+
|
175
|
+
|
176
|
+
|
177
|
+
@client.event
|
178
|
+
|
179
|
+
async def on_voice_state_update(member, before, after):
|
180
|
+
|
181
|
+
print("ボイスチャンネルで変化がありました")
|
182
|
+
|
183
|
+
|
184
|
+
|
185
|
+
if((before.self_mute is not after.self_mute) or (before.voice.self_deaf is not after.voice.self_deaf)):
|
186
|
+
|
187
|
+
print("ボイスチャンネルでミュート設定の変更がありました")
|
188
|
+
|
189
|
+
return
|
190
|
+
|
191
|
+
|
192
|
+
|
193
|
+
if(before.voice_channel is None):
|
194
|
+
|
195
|
+
pretime_dict[after.name] = datetime.datetime.now()
|
196
|
+
|
197
|
+
elif(after.voice_channel is None):
|
198
|
+
|
199
|
+
duration_time = pretime_dict[before.name] - datetime.datetime.now()
|
200
|
+
|
201
|
+
duration_time_adjust = int(duration_time.total_seconds()) * -1
|
202
|
+
|
203
|
+
|
204
|
+
|
205
|
+
reply_channel_name = "#Study-time"
|
206
|
+
|
207
|
+
reply_channel = [channel for channel in before.server.channels if channel.name == reply_channel_name][0]
|
208
|
+
|
209
|
+
reply_text = after.name + " が "+ before.voice_channel.name + " から抜けました。 通話時間:" + str(duration_time_adjust) +"秒"
|
210
|
+
|
211
|
+
|
212
|
+
|
213
|
+
await client.send_message(reply_channel ,reply_text)
|
214
|
+
|
215
|
+
|
216
|
+
|
217
|
+
client.run("token")
|
218
|
+
|
219
|
+
#エラーがこんなふうになりました。
|
220
|
+
|
221
|
+
File "c:\Users\user\Desktop\nob\Virtual_currency_of_the_tool\noob.py", line 19
|
222
|
+
|
223
|
+
if(before.voice_channel is None):
|
224
|
+
|
225
|
+
^
|
226
|
+
|
227
|
+
IndentationError: unindent does not match any outer indentation level
|
1
エラーが増えました
test
CHANGED
File without changes
|
test
CHANGED
@@ -1,26 +1,30 @@
|
|
1
|
-
|
1
|
+
#目的
|
2
2
|
|
3
|
-
|
3
|
+
discordのボイチャに入ったら、入った時間だけ時間を表示されるbotを作りたい。
|
4
4
|
|
5
|
-
言語
|
5
|
+
#言語
|
6
6
|
|
7
7
|
python
|
8
8
|
|
9
|
-
バージョン情報
|
10
9
|
|
11
|
-
Python3.9.4
|
12
10
|
|
13
|
-
|
11
|
+
#バージョン・ソフト
|
14
12
|
|
15
|
-
|
13
|
+
python3.9.4
|
16
14
|
|
15
|
+
|
16
|
+
|
17
|
+
vscode
|
18
|
+
|
19
|
+
|
20
|
+
|
17
|
-
参考サイト
|
21
|
+
#参考にしたサイト
|
18
22
|
|
19
23
|
https://qiita.com/tokkq/items/311aa297175b9cf7f946
|
20
24
|
|
21
25
|
|
22
26
|
|
23
|
-
コード
|
27
|
+
#コード
|
24
28
|
|
25
29
|
import discord
|
26
30
|
|
@@ -36,13 +40,21 @@
|
|
36
40
|
|
37
41
|
@client.event
|
38
42
|
|
43
|
+
async def on_ready():
|
44
|
+
|
45
|
+
print('ログインしました')
|
46
|
+
|
47
|
+
|
48
|
+
|
49
|
+
@client.event
|
50
|
+
|
39
|
-
async def on_voice_state_update(before, after):
|
51
|
+
async def on_voice_state_update(member, before, after):
|
40
52
|
|
41
53
|
print("ボイスチャンネルで変化がありました")
|
42
54
|
|
43
55
|
|
44
56
|
|
45
|
-
if((before.
|
57
|
+
if((before.self_mute is not after.self_mute) or (before.voice.self_deaf is not after.voice.self_deaf)):
|
46
58
|
|
47
59
|
print("ボイスチャンネルでミュート設定の変更がありました")
|
48
60
|
|
@@ -62,7 +74,7 @@
|
|
62
74
|
|
63
75
|
|
64
76
|
|
65
|
-
reply_channel_name = "
|
77
|
+
reply_channel_name = "Study-time"
|
66
78
|
|
67
79
|
reply_channel = [channel for channel in before.server.channels if channel.name == reply_channel_name][0]
|
68
80
|
|
@@ -76,72 +88,64 @@
|
|
76
88
|
|
77
89
|
client.run("token")
|
78
90
|
|
91
|
+
#エラーメッセージ
|
79
92
|
|
93
|
+
ログインしました
|
80
94
|
|
81
|
-
|
95
|
+
ボイスチャンネルで変化がありました
|
82
96
|
|
83
|
-
p
|
97
|
+
Ignoring exception in on_voice_state_update
|
84
98
|
|
85
|
-
|
99
|
+
Traceback (most recent call last):
|
86
100
|
|
87
|
-
|
101
|
+
File "C:\Program Files\Python39\lib\site-packages\discord\client.py", line 343, in
|
88
102
|
|
89
|
-
|
103
|
+
_run_event
|
90
104
|
|
91
|
-
|
105
|
+
await coro(*args, **kwargs)
|
92
106
|
|
93
|
-
|
107
|
+
File "C:\Users\user\Desktop\nob\Virtual_currency_of_the_tool\noob.py", line 15, in
|
94
108
|
|
95
|
-
|
109
|
+
on_voice_state_update
|
96
110
|
|
97
|
-
|
111
|
+
if((before.self_mute is not after.self_mute) or (before.voice.self_deaf is not after.voice.self_deaf)):
|
98
112
|
|
99
|
-
|
113
|
+
AttributeError: 'VoiceState' object has no attribute 'voice'
|
100
114
|
|
101
|
-
|
115
|
+
ボイスチャンネルで変化がありました
|
102
116
|
|
103
|
-
|
117
|
+
Ignoring exception in on_voice_state_update
|
104
118
|
|
105
|
-
|
119
|
+
Traceback (most recent call last):
|
106
120
|
|
107
|
-
|
121
|
+
File "C:\Program Files\Python39\lib\site-packages\discord\client.py", line 343, in
|
108
122
|
|
109
|
-
|
123
|
+
_run_event
|
110
124
|
|
111
|
-
|
125
|
+
await coro(*args, **kwargs)
|
112
126
|
|
113
|
-
|
127
|
+
File "C:\Users\user\Desktop\nob\Virtual_currency_of_the_tool\noob.py", line 15, in
|
114
128
|
|
115
|
-
|
129
|
+
on_voice_state_update
|
116
130
|
|
117
|
-
|
131
|
+
if((before.self_mute is not after.self_mute) or (before.voice.self_deaf is not after.voice.self_deaf)):
|
118
132
|
|
119
|
-
|
133
|
+
AttributeError: 'VoiceState' object has no attribute 'voice'
|
120
134
|
|
121
|
-
|
135
|
+
Exception ignored in: <function _ProactorBasePipeTransport.__del__ at 0x0000014F2B1DADC0>
|
122
136
|
|
123
|
-
|
137
|
+
Traceback (most recent call last):
|
124
138
|
|
125
|
-
|
139
|
+
File "C:\Program Files\Python39\lib\asyncio\proactor_events.py", line 116, in __del__
|
126
140
|
|
127
|
-
|
141
|
+
File "C:\Program Files\Python39\lib\asyncio\proactor_events.py", line 108, in close
|
128
142
|
|
129
|
-
|
143
|
+
File "C:\Program Files\Python39\lib\asyncio\base_events.py", line 746, in call_soon
|
130
144
|
|
131
|
-
|
145
|
+
File "C:\Program Files\Python39\lib\asyncio\base_events.py", line 510, in _check_closed
|
132
146
|
|
133
|
-
> File "C:\Program Files\Python39\lib\asyncio\proactor_events.py", line 116, in __del__
|
134
|
-
|
135
|
-
> File "C:\Program Files\Python39\lib\asyncio\proactor_events.py", line 108, in close
|
136
|
-
|
137
|
-
> File "C:\Program Files\Python39\lib\asyncio\base_events.py", line 746, in call_soon
|
138
|
-
|
139
|
-
> File "C:\Program Files\Python39\lib\asyncio\base_events.py", line 510, in _check_closed
|
140
|
-
|
141
|
-
|
147
|
+
RuntimeError: Event loop is closed。
|
142
|
-
|
143
|
-
|
144
148
|
|
145
149
|
やりたいこと
|
146
150
|
|
147
|
-
|
151
|
+
エラーの解決法を知りたい。
|