【发布时间】:2021-05-03 19:38:40
【问题描述】:
这是代码部分:
import discord
import random from discord.utils
import get import time
class MyClient(discord.Client):
#Einloggen
async def on_ready(self):
print("Eingeloggt")
#Wenn Nachricht gepostet wird
async def on_message(self, message):
if message.author == client.user:
return
if message.content == "$help":
print("help")
if message.content.startswith("$play"):
where = message.content.split(" ")[1]
channel = get(message.guild.channels, name=where)
voicechannel = await channel.connect()
voicechannel.play(discord.FFmpegPCMAudio('triggered.mp3'))
client = MyClient()
client.run("")
这是错误:
line 22, in on_message
voicechannel = await channel.connect()
AttributeError: 'TextChannel' object has no attribute 'connect
我已经安装了 discord、opus、ffmpg 和其他一些东西,我该怎么办? 请帮忙
【问题讨论】:
标签: python discord discord.py