mirror of
https://gitlab.com/niansa/asbots.git
synced 2025-03-06 20:48:25 +01:00
Further fixes and improvments (This is almost like Nintendo 3DS changelog lol)
This commit is contained in:
parent
29de614df2
commit
085ff14ea6
4 changed files with 16 additions and 3 deletions
|
@ -399,7 +399,7 @@ async::result<void> Instance::process(Event event) {
|
|||
if (event.args[1] == "SU") {
|
||||
// User logged in
|
||||
// Check args
|
||||
argsSizeCheck("ENCAP (SU)", event.args, 5);
|
||||
argsSizeCheck("ENCAP (SU)", event.args, 4);
|
||||
// Find user in cache
|
||||
auto res = cache.find_user_by_uid(event.args[2]);
|
||||
if (res == cache.users.end()) {
|
||||
|
|
|
@ -29,7 +29,6 @@ async::result<void> TestService::intitialize() {
|
|||
co_await mark_ready(user);
|
||||
co_await i->send_event(serviceChannel.get_sjoin(user.uid));
|
||||
co_await i->send_event(serviceChannel.get_topic("IRC Service channel", user.uid));
|
||||
//co_await i->send_event(user.get_encap_su("serviceD")); DOES NOT YET WORK!!
|
||||
co_await i->send_event(user.get_notice("Test... Hello world!", serviceChannelName));
|
||||
}
|
||||
|
||||
|
@ -39,8 +38,10 @@ async::result<void> TestService::on_event(const Event& event) {
|
|||
|
||||
async::result<void> TestService::on_direct_privmsg(std::string_view msg, u_User &author) {
|
||||
auto cmd = Utility::strSplit(msg, ' ', 1);
|
||||
auto command = Utility::lowers(cmd[0]);
|
||||
|
||||
Event response = user.get_notice("You need to log in first", author->uid);
|
||||
if (cmd[0] == "SEND") {
|
||||
if (command == "send") {
|
||||
if (author->loginName.value_or("") == "NetOP") {
|
||||
Event event;
|
||||
try {
|
||||
|
|
11
utility.cpp
11
utility.cpp
|
@ -38,7 +38,18 @@ void argsSizeCheck(std::string_view where, std::vector<std::string_view> args, s
|
|||
throw InsufficientArgsError(where, expected, args.size());
|
||||
}
|
||||
}
|
||||
|
||||
std::string lowers(std::string_view str) {
|
||||
std::string fres(str);
|
||||
for (auto& character : fres) {
|
||||
if (isalpha(character)) {
|
||||
character = std::tolower(character);
|
||||
}
|
||||
}
|
||||
return fres;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static const char UUIDChars[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
|
||||
UUID Instance::UUIDGen() {
|
||||
|
|
|
@ -13,5 +13,6 @@ constexpr size_t strSplitInf = 0;
|
|||
std::vector<std::string_view> strSplit(std::string_view s, char delimiter, size_t times = strSplitInf);
|
||||
std::tuple<std::string_view, std::string_view> colonSplit(std::string_view s);
|
||||
void argsSizeCheck(std::string_view where, std::vector<std::string_view> args, size_t expected);
|
||||
std::string lowers(std::string_view str);
|
||||
}
|
||||
#endif
|
||||
|
|
Loading…
Add table
Reference in a new issue