First commit

This commit is contained in:
2024-07-30 12:48:04 +02:00
parent 5583d15cda
commit f733a4c6b5
52 changed files with 541 additions and 1629 deletions

19
examples/test.py Normal file
View File

@@ -0,0 +1,19 @@
import discord
from pycord_reactive_views import ReactiveButton, ReactiveView
bot = discord.Bot()
class Counter(ReactiveView):
"""A simple counter view that increments a counter when a button is clicked."""
def __init__(self):
super().__init__()
self.counter = 0
self.counter_button = ReactiveButton(value=lambda: self.counter)
self.counter_button.callback = self._button_callback
self.add_item(self.counter_button)
async def _button_callback(self, interaction: discord.Interaction):
await interaction.response.defer()
self.counter += 1