does this satisfy your tastes
This commit is contained in:
parent
92fbacbfcb
commit
e928ba7550
|
@ -31,7 +31,7 @@ class Message:
|
||||||
evbus_messages = prometheus_client.Counter("abr_evbus_messages", "Messages processed by event bus", ["source_type"])
|
evbus_messages = prometheus_client.Counter("abr_evbus_messages", "Messages processed by event bus", ["source_type"])
|
||||||
evbus_messages_dropped = prometheus_client.Counter("abr_evbus_messages_dropped", "Messages received by event bus but dropped by rate limits", ["source_type"])
|
evbus_messages_dropped = prometheus_client.Counter("abr_evbus_messages_dropped", "Messages received by event bus but dropped by rate limits", ["source_type"])
|
||||||
|
|
||||||
# maps each bridge destination type (discord/APIONET/etc) to the listeners for it
|
# maps each bridge destination type (discord/APIONET/etc) to the listeners for it.
|
||||||
listeners = collections.defaultdict(set)
|
listeners = collections.defaultdict(set)
|
||||||
|
|
||||||
# maintains a list of all the unidirectional links between channels - key is source, values are targets
|
# maintains a list of all the unidirectional links between channels - key is source, values are targets
|
||||||
|
@ -102,4 +102,4 @@ async def initial_load(db):
|
||||||
rows = await db.execute_fetchall("SELECT * FROM links")
|
rows = await db.execute_fetchall("SELECT * FROM links")
|
||||||
for row in rows:
|
for row in rows:
|
||||||
links[(row["from_type"], row["from_id"])].add((row["to_type"], row["to_id"]))
|
links[(row["from_type"], row["from_id"])].add((row["to_type"], row["to_id"]))
|
||||||
logging.info("Loaded %d links", len(rows))
|
logging.info("Loaded %d links", len(rows))
|
||||||
|
|
|
@ -24,7 +24,7 @@ def render_formatting(message):
|
||||||
out += seg.replace("\n", " ")
|
out += seg.replace("\n", " ")
|
||||||
else:
|
else:
|
||||||
kind = seg["type"]
|
kind = seg["type"]
|
||||||
# TODO: check if user exists on both ends, and possibly drop if so
|
# TODO: check if user exists on both ends, and possibly drop if so
|
||||||
if kind == "user_mention":
|
if kind == "user_mention":
|
||||||
out += f"@{random_color(seg['id'])}{seg['name']}{color_code('')}"
|
out += f"@{random_color(seg['id'])}{seg['name']}{color_code('')}"
|
||||||
elif kind == "channel_mention": # these appear to be clickable across servers/guilds
|
elif kind == "channel_mention": # these appear to be clickable across servers/guilds
|
||||||
|
@ -60,9 +60,9 @@ async def initialize():
|
||||||
if channel_name in util.config["irc"]["channels"]:
|
if channel_name in util.config["irc"]["channels"]:
|
||||||
if channel_name not in joined: conn.join(channel_name)
|
if channel_name not in joined: conn.join(channel_name)
|
||||||
# if its a reply
|
# if its a reply
|
||||||
try:
|
dmsg = discord.fetch_message(msg.id)
|
||||||
if msg.reference:
|
if dmsg.reference.message_id:
|
||||||
conn.privmessage (channel_name, f"Replying to @{random_color(msg.reference.cached_message.author.id)}{msg.reference.cached_message.author.name}{color_code('')}:")
|
conn.privmessage(channel_name, f"Replying to @{random_color(dmsg.reference.cached_message.author.id)}{dmsg.reference.cached_message.author.name}{color_code('')}:")
|
||||||
# ping fix - zero width space embedded in messages
|
# ping fix - zero width space embedded in messages
|
||||||
line = f"<{random_color(msg.author.id)}{msg.author.name[0]}\u200B{msg.author.name[1:]}{color_code('')}> " + render_formatting(msg.message)[:400]
|
line = f"<{random_color(msg.author.id)}{msg.author.name[0]}\u200B{msg.author.name[1:]}{color_code('')}> " + render_formatting(msg.message)[:400]
|
||||||
conn.privmsg(channel_name, line)
|
conn.privmsg(channel_name, line)
|
||||||
|
|
Loading…
Reference in New Issue