Sending initial changes, adding the concept of Handlers, Views, Exceptions and Result, these class will optimaze the code in terms of cleanliness and organizational

This commit is contained in:
Rafael Vargas
2022-03-21 16:11:38 -04:00
parent 2bd100a3e1
commit 5c4d09bf9d
13 changed files with 241 additions and 6 deletions

View File

@@ -0,0 +1,34 @@
from abc import ABC, abstractmethod
from numpy import result_type
from vulkan.results.AbstractResult import AbstractResult
from discord.ext.commands import Context
from discord import Client, Message
class AbstractView(ABC):
def __init__(self, result: AbstractResult) -> None:
self.__result: AbstractResult = result
self.__context: Context = result.ctx
self.__message: Message = result.ctx.message
self.__bot: Client = result.ctx.bot
@property
def result(self) -> AbstractResult:
return self.__result
@property
def bot(self) -> Client:
return self.__result.ctx.bot
@property
def message(self) -> Message:
return self.__message
@property
def context(self) -> Context:
return self.__context
@abstractmethod
def run(self) -> None:
pass

10
vulkan/views/EmoteView.py Normal file
View File

@@ -0,0 +1,10 @@
from vulkan.views.AbstractView import AbstractView
from vulkan.results import AbstractResult
class EmoteView(AbstractView):
def __init__(self, result: AbstractResult) -> None:
super().__init__(result)
def run(self) -> None:
return super().run()

View File

@@ -0,0 +1,10 @@
from vulkan.views.AbstractView import AbstractView
from vulkan.results import AbstractResult
class MessageView(AbstractView):
def __init__(self, result: AbstractResult) -> None:
super().__init__(result)
def run(self) -> None:
return super().run()