11import logging
2- from discord_slash import SlashCommand , SlashContext , MenuContext
3- from discord_slash .model import ContextMenuType
2+ from typing import Union
3+ from discord_slash import SlashCommand , SlashContext , ComponentContext , MenuContext
4+ from discord_slash .model import ContextMenuType , ButtonStyle
5+ from discord_slash .utils .manage_components import create_actionrow , create_button
46from discord import Intents
57from discord .ext .commands import Bot
68
1113)
1214slash = SlashCommand (
1315 bot ,
14- sync_commands = True
16+ sync_commands = False
1517)
1618log = logging .Logger (name = "errors.log" , level = logging .DEBUG )
1719
@@ -35,10 +37,11 @@ async def testuser(ctx: MenuContext):
3537 await ctx .send ("test!" )
3638
3739@slash .context_menu (ContextMenuType .MESSAGE , name = "Testing Name Space" , guild_ids = [852402668294766612 ])
38- async def testmsg (ctx : MenuContext ):
39- await ctx .send ("test!" )
40+ async def testmsg (ctx : Union [ComponentContext , MenuContext ]):
41+ button = create_button (style = ButtonStyle .gray , label = "test button" , disabled = True )
42+ await ctx .send ("test!" , components = [create_actionrow (button )])
4043
4144for cmd in slash .commands ["context" ]:
4245 print (slash .commands ["context" ][cmd ]._type )
4346
44- bot .run ("Mzc5MzQzMzIyNTQ1NzgyNzg0.WgiY_w.uVRHvtT5KmGFuZ3zOiH_Y3MoGfc " , bot = True , reconnect = True )
47+ bot .run ("" , bot = True , reconnect = True )
0 commit comments