Get our hostname from WHO when we create fake events
This commit is contained in:
parent
220ce976f2
commit
813c9baf30
|
@ -482,7 +482,6 @@ class API(object):
|
||||||
@app.route("/irc/msg/<net>/<num>/<channel>/", methods=["PUT"])
|
@app.route("/irc/msg/<net>/<num>/<channel>/", methods=["PUT"])
|
||||||
@login_required
|
@login_required
|
||||||
def irc_send_message(self, request, net, num, channel):
|
def irc_send_message(self, request, net, num, channel):
|
||||||
print("IRC SEND", net, num, channel)
|
|
||||||
try:
|
try:
|
||||||
data = loads(request.content.read())
|
data = loads(request.content.read())
|
||||||
except JSONDecodeError:
|
except JSONDecodeError:
|
||||||
|
|
14
core/bot.py
14
core/bot.py
|
@ -16,7 +16,7 @@ from twisted.words.protocols.irc import (
|
||||||
|
|
||||||
import main
|
import main
|
||||||
from core.relay import sendRelayNotification
|
from core.relay import sendRelayNotification
|
||||||
from modules import chankeep, counters, helpers, monitor, regproc, userinfo
|
from modules import chankeep, counters, helpers, monitor, regproc, userinfo, userinfo
|
||||||
from utils.dedup import dedup
|
from utils.dedup import dedup
|
||||||
from utils.logging.debug import debug
|
from utils.logging.debug import debug
|
||||||
from utils.logging.log import error, log, warn
|
from utils.logging.log import error, log, warn
|
||||||
|
@ -253,7 +253,17 @@ class IRCBot(IRCClient):
|
||||||
self.event(type="action", muser=user, channel=channel, msg=msg)
|
self.event(type="action", muser=user, channel=channel, msg=msg)
|
||||||
|
|
||||||
def sendmsg(self, channel, msg):
|
def sendmsg(self, channel, msg):
|
||||||
self.event(type="self", mtype="msg", channel=channel, nick=self.nickname, msg=msg)
|
query = f"{self.nickname}!*@*"
|
||||||
|
us = list(userinfo.getWhoSingle(self.net, query))
|
||||||
|
if len(us) > 0:
|
||||||
|
hostmask = us[0]
|
||||||
|
else:
|
||||||
|
# Close enough...
|
||||||
|
hostmask = f"{self.nickname}!*@{self.servername}"
|
||||||
|
warn(f"Could not get a hostname, using {hostmask}")
|
||||||
|
nick, ident, host = parsen(hostmask)
|
||||||
|
self.event(type="self", mtype="msg", channel=channel, nick=self.nickname, ident=ident, host=host, msg=msg)
|
||||||
|
self.event(type="msg", channel=channel, nick=self.nickname, ident=ident, host=host, msg=msg)
|
||||||
self.msg(channel, msg)
|
self.msg(channel, msg)
|
||||||
|
|
||||||
def get(self, var):
|
def get(self, var):
|
||||||
|
|
Loading…
Reference in New Issue