qwreey/mina-discord-bot

making AfterHook-BeforeHook for making many games such as typing game, end word game etc

qwreey opened this issue · 0 comments

title says everything.
we should add hook features on before-after of message processing

like this

local newHook = hook.new {
  type = hook.type.before;
  func = function (message,...)
    print(message.content);
  end;
  userIdMatch = "some user id or nil";
  serverOnly = nil;
  prefixMatch = nil;
  -- there can be more options
};

newHook.mount(); -- this is will enable this hook
timer.sleep(1000);
newHook.unmount(); -- this is will disable this hook

after we make this feature, we can make many games!

the class HOOK will automatically destroy on memory by luajit's gc system
(so, we don't have to consider memory issues)