Skip to content

Commit b5d521b

Browse files
committed
🩹 Fix imported ApplicationContext under TYPE_CHECKING
1 parent 59ab5ec commit b5d521b

File tree

2 files changed

+32
-1
lines changed

2 files changed

+32
-1
lines changed

discord/commands/options.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,13 +39,13 @@
3939
Thread,
4040
VoiceChannel,
4141
)
42+
from ..commands import ApplicationContext
4243
from ..enums import ChannelType
4344
from ..enums import Enum as DiscordEnum
4445
from ..enums import SlashCommandOptionType
4546
from ..utils import MISSING, basic_autocomplete
4647

4748
if TYPE_CHECKING:
48-
from ..commands import ApplicationContext
4949
from ..ext.commands import Converter
5050
from ..member import Member
5151
from ..message import Attachment

thing.py

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
import logging
2+
import os
3+
4+
from dotenv import load_dotenv
5+
6+
import discord
7+
from discord.ext import bridge
8+
9+
logging.basicConfig(level=logging.INFO)
10+
11+
load_dotenv()
12+
TOKEN = os.getenv("TOKEN")
13+
14+
bot = bridge.Bot(intents=discord.Intents.all())
15+
16+
17+
@bot.event
18+
async def on_ready():
19+
print(f"We have logged in as {bot.user}")
20+
21+
22+
class MyCog(discord.Cog):
23+
@bridge.bridge_command(name="test", description="Hello World")
24+
async def test_cmd(
25+
self, ctx: bridge.BridgeExtContext | bridge.BridgeApplicationContext, param: str
26+
):
27+
await ctx.respond("Hello")
28+
29+
30+
bot.add_cog(MyCog())
31+
bot.run(TOKEN)

0 commit comments

Comments
 (0)