Enum values shouldn't be all upper case
This commit is contained in:
parent
2dc290951a
commit
5d7f017c9c
4 changed files with 7 additions and 7 deletions
|
@ -16,7 +16,7 @@ class Module(ModuleManager.BaseModule):
|
||||||
default_event = any(default_events)
|
default_event = any(default_events)
|
||||||
|
|
||||||
kwargs = {"args": line.args, "tags": line.tags, "server": server,
|
kwargs = {"args": line.args, "tags": line.tags, "server": server,
|
||||||
"prefix": line.prefix, "direction": utils.Direction.RECV}
|
"prefix": line.prefix, "direction": utils.Direction.Recv}
|
||||||
|
|
||||||
self.events.on("raw.received").on(line.command).call_unsafe(**kwargs)
|
self.events.on("raw.received").on(line.command).call_unsafe(**kwargs)
|
||||||
if default_event or not hooks:
|
if default_event or not hooks:
|
||||||
|
@ -35,7 +35,7 @@ class Module(ModuleManager.BaseModule):
|
||||||
def handle_send(self, event):
|
def handle_send(self, event):
|
||||||
self.events.on("raw.send").on(event["line"].command).call_unsafe(
|
self.events.on("raw.send").on(event["line"].command).call_unsafe(
|
||||||
args=event["line"].args, tags=event["line"].tags,
|
args=event["line"].args, tags=event["line"].tags,
|
||||||
server=event["server"], direction=utils.Direction.SEND)
|
server=event["server"], direction=utils.Direction.Send)
|
||||||
|
|
||||||
# ping from the server
|
# ping from the server
|
||||||
@utils.hook("raw.received.ping")
|
@utils.hook("raw.received.ping")
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
from src import utils
|
from src import utils
|
||||||
|
|
||||||
def _from_self(server, direction, prefix):
|
def _from_self(server, direction, prefix):
|
||||||
if direction == utils.Direction.SEND:
|
if direction == utils.Direction.Send:
|
||||||
if server.has_capability("echo-message"):
|
if server.has_capability("echo-message"):
|
||||||
return None
|
return None
|
||||||
else:
|
else:
|
||||||
|
|
|
@ -18,11 +18,11 @@ def handle_311(event):
|
||||||
|
|
||||||
def quit(events, event):
|
def quit(events, event):
|
||||||
nickname = None
|
nickname = None
|
||||||
if event["direction"] == utils.Direction.RECV:
|
if event["direction"] == utils.Direction.Recv:
|
||||||
nickname = event["prefix"].nickname
|
nickname = event["prefix"].nickname
|
||||||
reason = event["args"].get(0)
|
reason = event["args"].get(0)
|
||||||
|
|
||||||
if event["direction"] == utils.Direction.RECV:
|
if event["direction"] == utils.Direction.Recv:
|
||||||
nickname = event["prefix"].nickname
|
nickname = event["prefix"].nickname
|
||||||
if (not event["server"].is_own_nickname(nickname) and
|
if (not event["server"].is_own_nickname(nickname) and
|
||||||
not event["prefix"].hostmask == "*"):
|
not event["prefix"].hostmask == "*"):
|
||||||
|
|
|
@ -2,8 +2,8 @@ import datetime, decimal, enum, io, ipaddress, re, threading, typing
|
||||||
from src.utils import cli, consts, irc, http, parse, security
|
from src.utils import cli, consts, irc, http, parse, security
|
||||||
|
|
||||||
class Direction(enum.Enum):
|
class Direction(enum.Enum):
|
||||||
SEND = 0
|
Send = 0
|
||||||
RECV = 1
|
Recv = 1
|
||||||
|
|
||||||
ISO8601_PARSE = "%Y-%m-%dT%H:%M:%S%z"
|
ISO8601_PARSE = "%Y-%m-%dT%H:%M:%S%z"
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue