1
0
Fork 0
mirror of https://gitlab.com/niansa/SomeBot.git synced 2025-03-06 20:48:26 +01:00

Further improvements in translation

This commit is contained in:
niansa 2023-12-07 01:50:33 +01:00
parent f261d4553d
commit aeca2ed877
5 changed files with 15 additions and 15 deletions

View file

@ -22,12 +22,12 @@ public:
bot->add_chatcommand(Bot::ChatCommand({"make_embed"}, "Create an embed", dpp::slashcommand() bot->add_chatcommand(Bot::ChatCommand({"make_embed"}, "Create an embed", dpp::slashcommand()
.add_option(dpp::command_option(dpp::command_option_type::co_string, "title", "Title", true)) .add_option(dpp::command_option(dpp::command_option_type::co_string, "title", "Title", true))
.add_option(dpp::command_option(dpp::command_option_type::co_string, "description", "Description", true)) .add_option(dpp::command_option(dpp::command_option_type::co_string, "description", "Description", true))
.add_option(dpp::command_option(dpp::command_option_type::co_string, "image", "Image", false)) .add_option(dpp::command_option(dpp::command_option_type::co_string, "image", "Picture", false))
.add_option(dpp::command_option(dpp::command_option_type::co_string, "video", "Video", false)) .add_option(dpp::command_option(dpp::command_option_type::co_string, "video", "Video", false))
.add_option(dpp::command_option(dpp::command_option_type::co_string, "thumbnail", "Tiny picture", false)) .add_option(dpp::command_option(dpp::command_option_type::co_string, "thumbnail", "Tiny picture", false))
.add_option(dpp::command_option(dpp::command_option_type::co_string, "color", "Color", false)) .add_option(dpp::command_option(dpp::command_option_type::co_string, "color", "Color", false))
.add_option(dpp::command_option(dpp::command_option_type::co_string, "footer_text", "Footer text", false)) .add_option(dpp::command_option(dpp::command_option_type::co_string, "footer_text", "Footer text", false))
.add_option(dpp::command_option(dpp::command_option_type::co_string, "footer_image", "Tiny footer image", false)) .add_option(dpp::command_option(dpp::command_option_type::co_string, "footer_image", "Tiny footer picture", false))
.add_option(dpp::command_option(dpp::command_option_type::co_string, "content", "Text", false))), [&](const dpp::slashcommand_t& event) { .add_option(dpp::command_option(dpp::command_option_type::co_string, "content", "Text", false))), [&](const dpp::slashcommand_t& event) {
// Check that user has the correct permissions // Check that user has the correct permissions
if (!event.command.get_guild().base_permissions(event.command.member).has(dpp::permissions::p_manage_messages)) { if (!event.command.get_guild().base_permissions(event.command.member).has(dpp::permissions::p_manage_messages)) {
@ -49,7 +49,7 @@ public:
// Send embed // Send embed
bot->cluster.message_create(dpp::message().set_content(strOrEmpty(event.get_parameter("content"))).set_channel_id(event.command.channel_id).add_embed(embed)); bot->cluster.message_create(dpp::message().set_content(strOrEmpty(event.get_parameter("content"))).set_channel_id(event.command.channel_id).add_embed(embed));
// Report success // Report success
event.reply(dpp::message(std::string("The embed was created!") event.reply(dpp::message(std::string("Your embed has been created!")
+(color==-1U?"\n**Attention:** The specified color was not recognized! Try again with a color code.":"")).set_flags(dpp::message_flags::m_ephemeral)); +(color==-1U?"\n**Attention:** The specified color was not recognized! Try again with a color code.":"")).set_flags(dpp::message_flags::m_ephemeral));
}); });
} }

View file

@ -75,7 +75,7 @@ class Globalchat {
// Filter bad messages // Filter bad messages
bool is_bad = is_bad_message(original_msg.content); bool is_bad = is_bad_message(original_msg.content);
if (is_bad) { if (is_bad) {
original_msg.content = "*Message does not comply with the rules*"; original_msg.content = "*Message did not comply with the rules*";
} }
// Get user info // Get user info
unsigned color = Util::get_color_of_user(original_msg.author); unsigned color = Util::get_color_of_user(original_msg.author);
@ -247,7 +247,7 @@ class Globalchat {
channel.set_topic("This is the globalchat of the *"+bot->cluster.me.username+"* bot. Have fun!\n" channel.set_topic("This is the globalchat of the *"+bot->cluster.me.username+"* bot. Have fun!\n"
"\n" "\n"
"**Rules:**\n" "**Rules:**\n"
" **0.** Common Sense\n" " **0.** Common sense\n"
" **1.** No links and invites\n" " **1.** No links and invites\n"
" **2.** No trolling\n" " **2.** No trolling\n"
" **3.** No discussions about moderation decisions\n" " **3.** No discussions about moderation decisions\n"
@ -442,7 +442,7 @@ public:
} }
// Check if user is allowed to delete this message // Check if user is allowed to delete this message
if (event.command.guild_id != bot->config.management_guild_id && dpp::snowflake(author_id) != event.command.get_issuing_user().id) { if (event.command.guild_id != bot->config.management_guild_id && dpp::snowflake(author_id) != event.command.get_issuing_user().id) {
event.reply(dpp::message("You must not delete this message.").set_flags(dpp::message_flags::m_ephemeral)); event.reply(dpp::message("You can not delete this message.").set_flags(dpp::message_flags::m_ephemeral));
return; return;
} }
// Delete message everywhere // Delete message everywhere

View file

@ -136,7 +136,7 @@ public:
// Get level info message and reply with it // Get level info message and reply with it
event.reply(get_level_info_message(event.command.guild_id, target_id, target_is_sender, embed_enabled)); event.reply(get_level_info_message(event.command.guild_id, target_id, target_is_sender, embed_enabled));
}); });
bot->add_chatcommand(Bot::ChatCommand({"levels_leaderboard", "leaderboard"}, "Shows the level-leaderboard of this server"), [&](const dpp::slashcommand_t& event) { bot->add_chatcommand(Bot::ChatCommand({"levels_leaderboard", "leaderboard"}, "Shows the level leaderboard of this server"), [&](const dpp::slashcommand_t& event) {
// Get guild settings // Get guild settings
db_add_guild(event.command.guild_id); db_add_guild(event.command.guild_id);
auto [enabled, embed_enabled, speed, color] = get_guild_data(event.command.guild_id); auto [enabled, embed_enabled, speed, color] = get_guild_data(event.command.guild_id);
@ -218,7 +218,7 @@ public:
} }
// Report success // Report success
event.reply(dpp::message(std::string("Done!")+ event.reply(dpp::message(std::string("Done!")+
(bad_color?"\n**Warning:** I could not identify the color. Try again with a color code!":"")+ (bad_color?"\n**Warning:** I could not identify this color. Try again with a color code!":"")+
(bad_speed?"\n**Warning:** The specified speed is not allowed!":"")).set_flags(dpp::message_flags::m_ephemeral)); (bad_speed?"\n**Warning:** The specified speed is not allowed!":"")).set_flags(dpp::message_flags::m_ephemeral));
}); });
bot->add_chatcommand(Bot::ChatCommand({"levels_add_role", "level_role"}, "Add a level role", dpp::slashcommand().add_option(dpp::command_option(dpp::command_option_type::co_integer, "threshold", "Minimum level to have this role", true)).add_option(dpp::command_option(dpp::command_option_type::co_role, "role", "Role to assign", true))), [&](const dpp::slashcommand_t& event) { bot->add_chatcommand(Bot::ChatCommand({"levels_add_role", "level_role"}, "Add a level role", dpp::slashcommand().add_option(dpp::command_option(dpp::command_option_type::co_integer, "threshold", "Minimum level to have this role", true)).add_option(dpp::command_option(dpp::command_option_type::co_role, "role", "Role to assign", true))), [&](const dpp::slashcommand_t& event) {
@ -241,7 +241,7 @@ public:
<< std::to_string(role_id) << std::to_string(role_id)
<< threshold; << threshold;
// Report success // Report success
event.reply(dpp::message("People with at least the level "+std::to_string(threshold)+" are now assigned the role <@&"+std::to_string(role_id)+">!").set_allowed_mentions(true, false, false, true, {}, {})); event.reply(dpp::message("People with at least level "+std::to_string(threshold)+" are now assigned the role <@&"+std::to_string(role_id)+">!").set_allowed_mentions(true, false, false, true, {}, {}));
// Assign role where needed // Assign role where needed
bot->db << "SELECT user_id FROM levels " bot->db << "SELECT user_id FROM levels "
"WHERE guild_id = ? AND level >= ?;" "WHERE guild_id = ? AND level >= ?;"

View file

@ -100,7 +100,7 @@ public:
// Report sucess or errors that might have occured // Report sucess or errors that might have occured
std::string message = "On request of "+member.get_mention()+" **"+std::to_string(messages.size()-errors)+"** messages were deleted."; std::string message = "On request of "+member.get_mention()+" **"+std::to_string(messages.size()-errors)+"** messages were deleted.";
if (errors) { if (errors) {
message += "\n**Warning:** "+std::to_string(errors)+" messages could not be deleted as they may be too old."; message += "\n**Warning:** "+std::to_string(errors)+" messages could not be deleted (they may be too old).";
} }
bot->cluster.message_create(dpp::message(message).set_channel_id(channel_id)); bot->cluster.message_create(dpp::message(message).set_channel_id(channel_id));
}).detach(); }).detach();
@ -123,7 +123,7 @@ public:
// Ban // Ban
bot->cluster.guild_ban_add(event.command.guild_id, member_id, 0, [this, event, dm_ccb = ccb] (const dpp::confirmation_callback_t& ccb) { bot->cluster.guild_ban_add(event.command.guild_id, member_id, 0, [this, event, dm_ccb = ccb] (const dpp::confirmation_callback_t& ccb) {
if (ccb.is_error()) { if (ccb.is_error()) {
event.reply(dpp::message("I am not able to ban this person.").set_flags(dpp::message_flags::m_ephemeral)); event.reply(dpp::message("I am not able to ban this member.").set_flags(dpp::message_flags::m_ephemeral));
// Delete DM message because it's not valid // Delete DM message because it's not valid
if (!dm_ccb.is_error()) { if (!dm_ccb.is_error()) {
auto dm_msg = dm_ccb.get<dpp::message>(); auto dm_msg = dm_ccb.get<dpp::message>();
@ -151,7 +151,7 @@ public:
// Kick // Kick
bot->cluster.guild_member_kick(event.command.guild_id, member_id, [this, event, dm_ccb = ccb] (const dpp::confirmation_callback_t& ccb) { bot->cluster.guild_member_kick(event.command.guild_id, member_id, [this, event, dm_ccb = ccb] (const dpp::confirmation_callback_t& ccb) {
if (ccb.is_error()) { if (ccb.is_error()) {
event.reply(dpp::message("I am not able to kick this person.").set_flags(dpp::message_flags::m_ephemeral)); event.reply(dpp::message("I am not able to kick this member.").set_flags(dpp::message_flags::m_ephemeral));
// Delete DM message because it's not valid // Delete DM message because it's not valid
if (!dm_ccb.is_error()) { if (!dm_ccb.is_error()) {
auto dm_msg = dm_ccb.get<dpp::message>(); auto dm_msg = dm_ccb.get<dpp::message>();

View file

@ -97,7 +97,7 @@ class Ticket {
>> std::tie(title, description); >> std::tie(title, description);
} catch (...) { } catch (...) {
title = "Invalid ticket"; title = "Invalid ticket";
description = "Information could not be retrieved from the database."; description = "Data could not be retrieved from the database.";
} }
// Begin log // Begin log
std::ostringstream log; std::ostringstream log;
@ -281,7 +281,7 @@ public:
color_opt = event.get_parameter("color"); color_opt = event.get_parameter("color");
auto footer_text_opt = event.get_parameter("footer_text"); auto footer_text_opt = event.get_parameter("footer_text");
auto title = title_opt.index()!=0?std::get<std::string>(title_opt):"Support tickets", auto title = title_opt.index()!=0?std::get<std::string>(title_opt):"Support tickets",
text = text_opt.index()!=0?std::get<std::string>(text_opt):"Click to create ticket!", text = text_opt.index()!=0?std::get<std::string>(text_opt):"Click the button below to create a ticket!",
footer_text = footer_text_opt.index()!=0?std::get<std::string>(footer_text_opt):""; footer_text = footer_text_opt.index()!=0?std::get<std::string>(footer_text_opt):"";
unsigned color = Util::str_to_color(color_opt.index()!=0?std::get<std::string>(color_opt):"#ff2217"); unsigned color = Util::str_to_color(color_opt.index()!=0?std::get<std::string>(color_opt):"#ff2217");
// Send embed there // Send embed there
@ -362,7 +362,7 @@ public:
<< std::to_string(event.command.channel_id) << std::to_string(event.command.channel_id)
>> std::tie(author_id); >> std::tie(author_id);
} catch (...) { } catch (...) {
event.reply(dpp::message("Error. Is this really a ticket channel?").set_flags(dpp::message_flags::m_ephemeral)); event.reply(dpp::message("**Error:** Is this actually a ticket channel?").set_flags(dpp::message_flags::m_ephemeral));
return; return;
} }
// Send message // Send message