我想让bot说Snacktoshis: 5
,但它不会在聊天中打印变量。在
这是我的代码:
from discord import *
from discord.ext import *
from discord.ext.commands import Bot
from discord.ext.commands import *
import random
import asyncio
from discord import Game
from discord.ext.commands import Bot
import aiohttp
import discord
import requests
import time
BOT_PREFIX = ("?", "!")
client = Bot(command_prefix=BOT_PREFIX)
TOKEN ="3812236138921603126360103210983inserttoken21831382ufsfuadha"
@client.command()
async def bal():
snack = 0
await client.say("Snacktoshis:",snack)
client.run(TOKEN)
我的错误消息是:
^{pr2}$我知道我有很多未使用的模块。在
我想你的意思是这样的:
其中变量应该是消息的一部分,而不是方法调用的单独参数。在
来自
help('discord.ext.commands.Bot.say')
:因此,从您的}。您希望发送的消息是单个字符串,而不是两个单独的参数。在
client.say
调用发送到send_message
的四个参数是client
,message.channel
,"Snacktoshis:"
,和{或者
^{pr2}$相关问题 更多 >
编程相关推荐