30 lines
715 B
Python
30 lines
715 B
Python
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())
|