不适合' int'到索引大小的整数

时间:2018-04-03 09:27:42

标签: python python-3.x discord discord.py

如果我想使用索引,我会收到错误:

Ignoring exception in on_message
Traceback (most recent call last):
File "C:\Users\Robson1608\AppData\Local\Programs\Python\Python36-32\lib\site-packages\discord\client.py", line 307, in _run_event
yield from getattr(self, event)(*args, **kwargs)
File "C:\Users\Robson1608\Desktop\Nowy folder\run.py", line 79, in on_message
await cmds.get(invoke).ex(args, message, client, invoke)
File "C:\Users\Robson1608\Desktop\Nowy folder\commands\cmd_play.py", line 7, in ex
await Music().play(client, message, message.author.voice.voice_channel, link)
File "C:\Users\Robson1608\Desktop\Nowy folder\core\discordmusic.py", line 11, in play
self.players[int(message.server.id)] = await voice.create_ytdl_player(link, use_avconv=False)
IndexError: cannot fit 'int' into an index-sized integer

代码在这里:

def __init__(self):
    self.players = []
async def play(self, client, message, channel, link):
    voice = await client.join_voice_channel(channel)
    voice.encoder_options(sample_rate=48000, channels=2)
    self.players[int(message.server.id)] = await voice.create_ytdl_player(link, use_avconv=False)
    self.players[int(message.server.id)].start()
def pause(self, message):
    self.players[int(message.server.id)].pause()

有什么想法解决这个问题吗? ;我不知道什么是问题我搜索谷歌但没有看到任何解决方案

0 个答案:

没有答案