Skip to content

AsyncWebhookAdapter.request never awaited by it class methods #929

Closed
@franciscosbf

Description

@franciscosbf

Summary

Method is never awaited by AsyncWebhookAdapter methods

Reproduction Steps

interaction.response.edit_message(...) which interaction is an instance of discord.Interaction

Internally, edit_message calls AsyncWebhookAdapter.create_interaction_response as a asynchronous function, although isn't defined as a coroutine. Furthermore, AsyncWebhookAdapter.request (coroutine called by AsyncWebhookAdapter.create_interaction_response) is never awaited.

Minimal Reproducible Code

import discord

@bot.command(name='none')
async def none(ctx):
	view = discord.ui.View(timeout=20)
	
	select = discord.ui.Select(placeholder='Select one', options=[discord.SelectOption(label='One')])
	async def on_selection(interaction):
		embed = discord.Embed(title='Selected')
		await interaction.response.edit_message(embed=embed,view=None)
		view.stop()
	select.callback = on_selection
	view.add_item(select)
	
	await ctx.send('hi!', view=view)

TOKEN = ''
bot.run(TOKEN)

Expected Results

Make all calls to AsyncWebhookAdapter.request awaited and the methods that calls request defined as a coroutine.

Actual Results

During execution, got the exception message RuntimeWarning: coroutine 'AsyncWebhookAdapter.request' was never awaited.

Intents

guilds=True, members=True, bans=True, emojis_and_stickers=True, invites=True, voice_states=True, presences=True, guild_messages=True, guild_reactions=True, scheduled_events=True

System Information

  • Python v3.10.2-final
  • py-cord v2.0.0-beta
    • py-cord pkg_resources: v2.0.0b3
  • aiohttp v3.8.1
  • system info: Linux 5.16.4-arch1-1 Update README.rst #1 SMP PREEMPT Sat, 29 Jan 2022 19:08:13 +0000

Checklist

  • I have searched the open issues for duplicates.
  • I have shown the entire traceback, if possible.
  • I have removed my token from display, if visible.

Additional Context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    unconfirmed bugA bug report that needs triaging

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions