Migration vers Disnake et ajout des components V2
This commit is contained in:
parent
c8c579eefe
commit
98f7501e07
47 changed files with 1196 additions and 722 deletions
30
backups/scratch/check_button_sig.py
Normal file
30
backups/scratch/check_button_sig.py
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
import disnake
|
||||
from disnake.ui import View, Button
|
||||
import asyncio
|
||||
|
||||
class MyView(View):
|
||||
def __init__(self):
|
||||
super().__init__(timeout=None)
|
||||
|
||||
@disnake.ui.button(label="Test")
|
||||
async def my_btn(self, arg1, arg2):
|
||||
print(f"Arg1 type: {type(arg1)}")
|
||||
print(f"Arg2 type: {type(arg2)}")
|
||||
|
||||
async def main():
|
||||
view = MyView()
|
||||
btn = view.children[0]
|
||||
print(f"Button: {btn}")
|
||||
# Mock an interaction
|
||||
class MockInteraction:
|
||||
pass
|
||||
|
||||
try:
|
||||
await btn.callback(MockInteraction())
|
||||
except Exception as e:
|
||||
print(f"Error during callback: {e}")
|
||||
import traceback
|
||||
traceback.print_exc()
|
||||
|
||||
if __name__ == "__main__":
|
||||
asyncio.run(main())
|
||||
Loading…
Add table
Add a link
Reference in a new issue