From 13ae534e565bdf24bc56d758793f46a2475267d8 Mon Sep 17 00:00:00 2001 From: Anorak_1 Date: Thu, 17 Aug 2023 23:28:27 +0200 Subject: [PATCH] =?UTF-8?q?First=20commits=20for=20Application=20Actions?= =?UTF-8?q?=E2=84=A2=20object?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- action.py | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 action.py diff --git a/action.py b/action.py new file mode 100644 index 0000000..42f9bf2 --- /dev/null +++ b/action.py @@ -0,0 +1,23 @@ +from typing import Any, TypeVar, NewType +from enum import Enum +import discord + +AT = TypeVar("AT", bound="Action") + +class ActionInteraction(Enum): + ACCEPT = "accept" + DECLINE = "decline" + +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") + +