From c31cbe0fb6edffd25739830c10163516bbae48d9 Mon Sep 17 00:00:00 2001 From: Georgios Atheridis Date: Fri, 30 Sep 2022 17:25:45 +0000 Subject: [PATCH] messages sent by bot now added to database --- skgyorugo/auto_messages/caedrel.py | 9 +++++++++ skgyorugo/tools/smart_privmsg.py | 14 ++++++++++++++ 2 files changed, 23 insertions(+) create mode 100644 skgyorugo/auto_messages/caedrel.py diff --git a/skgyorugo/auto_messages/caedrel.py b/skgyorugo/auto_messages/caedrel.py new file mode 100644 index 0000000..d3f2c1b --- /dev/null +++ b/skgyorugo/auto_messages/caedrel.py @@ -0,0 +1,9 @@ +from aptbot.bot import Message, Commands, Bot + +COOLDOWN = 90 * 60 +END_TIME = 0 + + +def main(bot: Bot, message: Message): + msg = "Watch caedrel react to peks KEKW https://clips.twitch.tv/GentleNimbleStarPrimeMe-sZRWuCU6llKgbAlh" + bot.send_privmsg(message.channel, msg) diff --git a/skgyorugo/tools/smart_privmsg.py b/skgyorugo/tools/smart_privmsg.py index 13c477d..92bfe14 100644 --- a/skgyorugo/tools/smart_privmsg.py +++ b/skgyorugo/tools/smart_privmsg.py @@ -1,5 +1,7 @@ from aptbot.bot import Bot, Message, Commands from typing import Union +from .. import database_manager +import time MAX_LENGTH = 480 @@ -62,6 +64,18 @@ def send( message = message.replace("{channel}", message_data.channel) messages = _split_message(message) + for message in messages: + if reply: + tags = {"display-name": "MurphyAI", "tmi-sent-ts": int(time.time() * 1000), "user-id": "784114488", "room-id": "169701299", "reply-parent-msg-id": reply} + database_manager.add_message_tochat_history( + Message( + tags=tags, + nick="murphyai", + command=Commands.PRIVMSG, + message_data.channel, + value=message + ) + ) if safe_send: send_safe(bot, message_data.channel, messages, reply) else: -- 2.30.2