所以我正在制作一个等待用户输入的机器人,然后更改嵌入描述中的数字。我当前的代码在 discord 中给出了错误:错误:命令引发异常:类型错误:只能将 str(不是“int”)连接到 str
import discord
from discord.ext import commands, tasks
import os
import B
import wargaming
wot = wargaming.WoT('demo', region='na', language='en')
key=os.getenv('key')#just some things you might want inside the bot here.
wkey=os.getenv('wkey')
client = discord.Client()#declaring what the client is.
client = commands.Bot(command_prefix = ';;')
client.remove_command('help')
@client.event
async def on_ready():
await client.change_presence(activity=discord.Activity(type=discord.ActivityType.watching, name="Skirmish Tactics"))
print("Bot is ready!")
def check(ctx):
return lambda m: m.author == ctx.author and m.channel == ctx.channel
async def get_input_of_type(func, ctx):
while True:
try:
msg = await client.wait_for('message', check=check(ctx))
return func(msg.content)
except ValueError:
continue
@client.command()
async def skirmishstandings(ctx):
await ctx.send('Enter skirmish tier(6,8,10):')
tier = await get_input_of_type(int, ctx)
position = discord.Embed(title="Irish Rouge Ecelon's stronghold position", description="IRE's stronghold positon for tier" + int(tier) + "skirmishes")
await ctx.send(embed=position)
@client.event
async def on_command_error(ctx, error):
await ctx.send(f'Error: {error}')
我查看了堆栈溢出并更改了我的代码很多但不幸的是没有成功。我想我会问我自己的问题。任何帮助表示赞赏!谢谢!
慕容森
相关分类