mirror of
https://gitlab.com/niansa/discordlistforbots.git
synced 2025-03-06 20:49:22 +01:00
Fixed bot owner username invalidating on moderator edit
This commit is contained in:
parent
61e5c2ad6c
commit
5605f89a4d
2 changed files with 7 additions and 4 deletions
|
@ -275,11 +275,14 @@ void views::botedit(const HttpRequestPtr& req, std::function<void (const HttpRes
|
|||
[this, sessionData, refresh, bot, final] (const orm::Result &) {
|
||||
if (refresh) {
|
||||
auto app_id = bot.app_id;
|
||||
getUser(app_id, [this, sessionData, app_id, final] (const Json::Value& botuser) {
|
||||
auto owner_id = bot.owner_id;
|
||||
getUser(app_id, [this, sessionData, app_id, owner_id, final] (const Json::Value& botuser) {
|
||||
if (not botuser.empty()) {
|
||||
db->execSqlAsync("UPDATE bots SET name = '"+dbEsc(botuser["username"].asString())+"',"
|
||||
"avatar_url = '"+dbEsc(botuser["avatar_url"].asString())+"',"
|
||||
"owner = '"+dbEsc(sessionData->discord_fullname())+"' "
|
||||
"avatar_url = '"+dbEsc(botuser["avatar_url"].asString())+
|
||||
std::string(sessionData->discord_id==owner_id?
|
||||
("',owner = '"+dbEsc(sessionData->discord_fullname())+"' "):
|
||||
("' "))+
|
||||
"WHERE app_id = '"+std::to_string(app_id)+"'",
|
||||
[final] (const orm::Result &) {
|
||||
final();
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
<p class="title">Discordlist for Bots</p>
|
||||
<p>Find a lot of bots that will be useful to your server</p>
|
||||
<%c++ if (@@.get<bool>("authed")) {%>
|
||||
<%c++ if (justMine) {%>
|
||||
<%c++ if (justMine or modView) {%>
|
||||
<a class="special-button" href="@all">All bots</a>
|
||||
<%c++ } else {%>
|
||||
<a class="special-button" href="@me">My bots</a>
|
||||
|
|
Loading…
Add table
Reference in a new issue