v1.1
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import inspect
|
||||
import re
|
||||
|
||||
from kurocore.main.message import MessageArgs
|
||||
|
||||
|
||||
class MethodWithPriority:
|
||||
__slots__ = ('priority', 'method')
|
||||
@@ -160,12 +161,10 @@ class Plugin:
|
||||
self.tasks.append(f)
|
||||
return f
|
||||
|
||||
async def _process_command(self, command: str, msg, args):
|
||||
sig = inspect.signature(self.commands[command])
|
||||
if len(sig.parameters) == 1:
|
||||
await self.commands[command](msg)
|
||||
elif len(sig.parameters) == 2:
|
||||
await self.commands[command](msg, args)
|
||||
async def _process_command(self, command: str, ctx, args):
|
||||
# sig = inspect.signature(self.commands[command])
|
||||
ctx.args = args
|
||||
await self.commands[command](ctx)
|
||||
|
||||
async def _process_payload(self, payload: str, msg):
|
||||
await self.payloads[payload](msg)
|
||||
@@ -180,7 +179,6 @@ class Plugin:
|
||||
return command in self.admin_commands
|
||||
|
||||
async def _validate_command_args(self, command: str, cmd_args: tuple):
|
||||
from kurocore import MessageArgs
|
||||
commands_args = self.commands_args
|
||||
if command not in commands_args:
|
||||
return True, MessageArgs({})
|
||||
@@ -215,7 +213,6 @@ class Plugin:
|
||||
return True, MessageArgs(args)
|
||||
|
||||
async def _validate_payload_args(self, payload: str, msg_args: dict):
|
||||
from kurocore import MessageArgs
|
||||
payloads_args = self.payloads_args
|
||||
if payload not in payloads_args:
|
||||
return True, None
|
||||
|
||||
Reference in New Issue
Block a user