【发布时间】:2021-03-26 13:55:04
【问题描述】:
import os
import discord
import random
from prettytable import PrettyTable
from PIL import Image
client = discord.client()
@client.event
async def on_ready():
print("We have logged in as {0.user}".format(client))
@client.event
async def on_message(message):
if message.author == client.user:
return
if message.content.startswith("$picture"):
await channel.send(file=discord.File("images.jpg"))
client.run(os.getenv('TOKEN'))
您好,这是我第一次使用堆栈溢出,如果我的帖子有一些错误,我提前道歉,
所以当我在聊天框中输入“$picture”时,我试图让我的不和谐上传一张图片,但是我在await channel.send(file=discord.File("images.jpg")) 说“未定义的命名为'频道'”的行上得到一个红色下划线我试着调查它但找不到太多。有任何想法吗?谢谢。
【问题讨论】:
-
这意味着您的变量没有在任何地方定义。 @GGberry 有正确的解决方案