diff --git a/controllers/views.cc b/controllers/views.cc index 45575bc..8748e5d 100644 --- a/controllers/views.cc +++ b/controllers/views.cc @@ -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(); diff --git a/views/botlist.csp b/views/botlist.csp index 46110d8..e63edfd 100644 --- a/views/botlist.csp +++ b/views/botlist.csp @@ -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>