mirror of
https://github.com/Syping/dtranslatebot.git
synced 2025-09-11 11:16:38 +02:00
add basic avatar support to webhook
This commit is contained in:
parent
5e78c2728a
commit
502cabd7a7
11 changed files with 128 additions and 14 deletions
|
@ -21,6 +21,11 @@
|
|||
#include <iostream>
|
||||
#include "settings.h"
|
||||
|
||||
uint16_t bot::settings::settings::get_avatar_size()
|
||||
{
|
||||
return m_avatarSize;
|
||||
}
|
||||
|
||||
bot::settings::channel* bot::settings::settings::get_channel(bot::settings::guild *guild, uint64_t channel_id)
|
||||
{
|
||||
for (auto channel = guild->channel.begin(); channel != guild->channel.end(); channel++) {
|
||||
|
@ -147,6 +152,17 @@ bool bot::settings::settings::parse(const std::string &filename)
|
|||
else
|
||||
m_translate.apiKey.clear();
|
||||
|
||||
auto json_avatarSize = json.find("avatar_size");
|
||||
if (json_avatarSize != json.end()) {
|
||||
m_avatarSize = json_avatarSize.value();
|
||||
if (m_avatarSize < 16)
|
||||
m_avatarSize = 16;
|
||||
else if (m_avatarSize > 4096)
|
||||
m_avatarSize = 4096;
|
||||
}
|
||||
else
|
||||
m_avatarSize = 256;
|
||||
|
||||
m_guilds.clear();
|
||||
m_webhookIds.clear();
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue