From 31855cd1b13c7c70480b9df35060fd6f5254798a Mon Sep 17 00:00:00 2001 From: Green Sky Date: Fri, 25 Oct 2024 12:54:04 +0200 Subject: [PATCH] use sr --- src/solanaceae/rpbot/rpbot.cpp | 4 ++-- src/solanaceae/rpbot/rpbot.hpp | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/solanaceae/rpbot/rpbot.cpp b/src/solanaceae/rpbot/rpbot.cpp index 66bb44b..206fbfa 100644 --- a/src/solanaceae/rpbot/rpbot.cpp +++ b/src/solanaceae/rpbot/rpbot.cpp @@ -140,7 +140,7 @@ RPBot::RPBot( Contact3Registry& cr, RegistryMessageModelI& rmm, MessageCommandDispatcher* mcd -) : _completion(completion), _conf(conf), _cr(cr), _rmm(rmm), _mcd(mcd) { +) : _completion(completion), _conf(conf), _cr(cr), _rmm(rmm), _rmm_sr(_rmm.newSubRef(this)), _mcd(mcd) { //system_prompt = R"sys(Transcript of a group chat, where Bob talks to online strangers. //)sys"; @@ -157,7 +157,7 @@ R"sys(Transcript of a group chat, where {self_name} talks to online strangers. registerCommands(); - _rmm.subscribe(this, RegistryMessageModel_Event::message_construct); + _rmm_sr.subscribe(RegistryMessageModel_Event::message_construct); } float RPBot::tick(float time_delta) { diff --git a/src/solanaceae/rpbot/rpbot.hpp b/src/solanaceae/rpbot/rpbot.hpp index ed059fc..28868cd 100644 --- a/src/solanaceae/rpbot/rpbot.hpp +++ b/src/solanaceae/rpbot/rpbot.hpp @@ -21,6 +21,7 @@ struct RPBot : public RegistryMessageModelEventI { ConfigModelI& _conf; Contact3Registry& _cr; RegistryMessageModelI& _rmm; + RegistryMessageModelI::SubscriptionReference _rmm_sr; MessageCommandDispatcher* _mcd; std::minstd_rand _rng{std::random_device{}()};