2023-08-17 21:28:27 +00:00
|
|
|
from typing import Any, TypeVar, NewType
|
|
|
|
from enum import Enum
|
|
|
|
import discord
|
|
|
|
|
2023-08-19 21:09:51 +00:00
|
|
|
actions = {
|
|
|
|
"Add Role": "add_role"
|
|
|
|
}
|
2023-08-17 21:28:27 +00:00
|
|
|
|
|
|
|
class ActionInteraction(Enum):
|
2023-08-19 21:09:51 +00:00
|
|
|
ACCEPT = "Accept"
|
|
|
|
DECLINE = "Decline"
|
2023-08-17 21:28:27 +00:00
|
|
|
|
|
|
|
class Action():
|
|
|
|
def __init__(self, action: ActionInteraction):
|
|
|
|
self.set_type = None
|
|
|
|
self.app_result = action
|
|
|
|
|
|
|
|
def add_role(self, role: discord.Role):
|
|
|
|
if self.set_type is None:
|
|
|
|
self.set_type = "add_role"
|
|
|
|
self.add_role_value = role
|
|
|
|
else:
|
|
|
|
raise ValueError("Action object already set type")
|
|
|
|
|
2023-08-19 21:09:51 +00:00
|
|
|
def get_data(self):
|
|
|
|
if self.set_type is not None:
|
|
|
|
return {
|
|
|
|
"type": self.set_type
|
|
|
|
}
|
|
|
|
|
2023-08-17 21:28:27 +00:00
|
|
|
|