fun dance (private reply for now)

This commit is contained in:
Green Sky 2023-12-15 01:59:19 +01:00
parent 113a9ec099
commit de3f845918
No known key found for this signature in database
4 changed files with 71 additions and 0 deletions

View File

@ -23,6 +23,9 @@ add_executable(totato
./tox_commands.hpp
./tox_commands.cpp
./fun_commands.hpp
./fun_commands.cpp
)
target_compile_features(totato PUBLIC cxx_std_17)

50
src/fun_commands.cpp Normal file
View File

@ -0,0 +1,50 @@
#include "./managment_commands.hpp"
#include <random>
#include <solanaceae/contact/contact_model3.hpp>
//#include <solanaceae/util/config_model.hpp>
#include "./message_command_dispatcher.hpp"
#include <solanaceae/message3/components.hpp>
//#include <solanaceae/contact/components.hpp>
void registerFunCommands(
MessageCommandDispatcher& mcd,
ConfigModelI& conf,
Contact3Registry& cr,
RegistryMessageModel& rmm
) {
mcd.registerCommand(
"fun", "fun",
"dance",
[&](std::string_view params, Message3Handle m) -> bool {
static std::default_random_engine rng{std::random_device{}()};
const auto contact_from = m.get<Message::Components::ContactFrom>().c;
static const std::array<std::string_view, 12> dances {
"DANCE",
"(~^.^)~",
"♪┌|∵|┘♪",
"~( °٢° )~",
"m/...(>.<)…m/",
"(~‾⌣‾)~",
"└[∵┌]└[ ∵ ]┘[┐∵]┘",
"♨(⋆‿⋆)♨",
"ヾ(*´∀`*",
"ლ(o◡oლ)",
"┌(★o☆)┘",
"ヘ(^_^ヘ)",
};
rmm.sendText(
contact_from,
dances.at(rng()%dances.size())
);
return true;
},
"Make totato dance.",
MessageCommandDispatcher::Perms::EVERYONE
);
}

16
src/fun_commands.hpp Normal file
View File

@ -0,0 +1,16 @@
#pragma once
#include <solanaceae/contact/contact_model3.hpp>
#include <solanaceae/message3/registry_message_model.hpp>
// fwd
class MessageCommandDispatcher;
struct ConfigModelI;
void registerFunCommands(
MessageCommandDispatcher& mcd,
ConfigModelI& conf,
Contact3Registry& cr,
RegistryMessageModel& rmm
);

View File

@ -18,6 +18,7 @@
#include "./managment_commands.hpp"
#include "./config_commands.hpp"
#include "./tox_commands.hpp"
#include "./fun_commands.hpp"
//#include <solanaceae/message3/components.hpp>
//#include <solanaceae/contact/components.hpp>
@ -247,6 +248,7 @@ int main(int argc, char** argv) {
// TODO: finish impl
//registerConfigCommands(mcd, conf, cr, rmm);
registerToxCommands(mcd, conf, cr, rmm, tc, tpi);
registerFunCommands(mcd, conf, cr, rmm);
conf.dump();