mirror of
https://github.com/Syping/dtranslatebot.git
synced 2024-12-22 11:55:30 +01:00
Fix: add generated webhooks to webhook vector
This commit is contained in:
parent
3a158b400f
commit
eb301aee1c
3 changed files with 12 additions and 3 deletions
|
@ -142,8 +142,10 @@ int main(int argc, char* argv[]) {
|
|||
s_target.webhook = webhook;
|
||||
s_channel.targets.push_back(s_target);
|
||||
|
||||
const std::lock_guard<bot::settings::settings> guard(settings);
|
||||
settings.lock();
|
||||
settings.add_channel(s_channel, event.command.guild_id);
|
||||
settings.add_translatebot_webhook(webhook);
|
||||
settings.unlock();
|
||||
|
||||
event.reply(dpp::message("Channel will be now translated!").set_flags(dpp::m_ephemeral));
|
||||
});
|
||||
|
@ -158,8 +160,10 @@ int main(int argc, char* argv[]) {
|
|||
s_target.webhook = *webhook;
|
||||
s_channel.targets.push_back(s_target);
|
||||
|
||||
const std::lock_guard<bot::settings::settings> guard(settings);
|
||||
settings.lock();
|
||||
settings.add_channel(s_channel, event.command.guild_id);
|
||||
settings.add_translatebot_webhook(*webhook);
|
||||
settings.unlock();
|
||||
|
||||
event.reply(dpp::message("Channel will be now translated!").set_flags(dpp::m_ephemeral));
|
||||
}
|
||||
|
|
|
@ -36,7 +36,11 @@ void bot::settings::settings::add_channel(const bot::settings::channel &channel,
|
|||
guild.id = guild_id;
|
||||
guild.channel.push_back(channel);
|
||||
m_guilds.push_back(guild);
|
||||
return;
|
||||
}
|
||||
|
||||
void bot::settings::settings::add_translatebot_webhook(const dpp::webhook &webhook)
|
||||
{
|
||||
m_webhookIds.push_back(webhook.id);
|
||||
}
|
||||
|
||||
uint16_t bot::settings::settings::get_avatar_size()
|
||||
|
|
|
@ -52,6 +52,7 @@ namespace bot {
|
|||
class settings {
|
||||
public:
|
||||
void add_channel(const bot::settings::channel &channel, dpp::snowflake guild_id);
|
||||
void add_translatebot_webhook(const dpp::webhook &webhook);
|
||||
uint16_t get_avatar_size();
|
||||
const bot::settings::channel* get_channel(const bot::settings::guild *guild, dpp::snowflake channel_id);
|
||||
const bot::settings::channel* get_channel(dpp::snowflake guild_id, dpp::snowflake channel_id);
|
||||
|
|
Loading…
Reference in a new issue