Aiohttp 向 discord.py 中的字符串添加值
Aiohttp adding values to string in discord.py
我正在尝试将用户的响应添加到 URL。我的密码是
async def dungeondata():
async with aiohttp.ClientSession(connector=aiohttp.TCPConnector(ssl=False)) as session:
async with session.get('https://sky.shiiyu.moe/api/v2/dungeons/{}/{}'.format(name, cutename)) as resp:
return await resp.json()
@bot.command(name='dungeon', aliases=['dungeons'])
async def dungeon(ctx, name, cutename):
JSONData = await dungeondata(name, cutename)
当用户执行 ?dungeons 时,我尝试将 and 添加到 URL,以便 url 变为 https://sky.shiiyu.moe/api/v2/dungeons/name/cutename。我该怎么做?
在 dungeon
函数中添加 name
和 cutename
作为参数。
async def dungeon(name, cutename):
async with aiohttp.ClientSession(connector=aiohttp.TCPConnector(ssl=False)) as session:
async with session.get('https://sky.shiiyu.moe/api/v2/dungeons/{}/{}'.format(name, cutename)) as resp:
return await resp.json()
我正在尝试将用户的响应添加到 URL。我的密码是
async def dungeondata():
async with aiohttp.ClientSession(connector=aiohttp.TCPConnector(ssl=False)) as session:
async with session.get('https://sky.shiiyu.moe/api/v2/dungeons/{}/{}'.format(name, cutename)) as resp:
return await resp.json()
@bot.command(name='dungeon', aliases=['dungeons'])
async def dungeon(ctx, name, cutename):
JSONData = await dungeondata(name, cutename)
当用户执行 ?dungeons 时,我尝试将 and 添加到 URL,以便 url 变为 https://sky.shiiyu.moe/api/v2/dungeons/name/cutename。我该怎么做?
在 dungeon
函数中添加 name
和 cutename
作为参数。
async def dungeon(name, cutename):
async with aiohttp.ClientSession(connector=aiohttp.TCPConnector(ssl=False)) as session:
async with session.get('https://sky.shiiyu.moe/api/v2/dungeons/{}/{}'.format(name, cutename)) as resp:
return await resp.json()