mirror of
https://github.com/pagefaultgames/rogueserver.git
synced 2025-02-23 17:11:29 +08:00

* feat: Add admin Discord link endpoint * feat: Add Discord Guild ID flag to server configuration * feat: Add logging for Discord ID addition in admin Discord link endpoint * chore: Update variable name for Discord guild ID in account package * chore: Add logging for Discord ID addition in admin Discord link endpoint * chore: Add admin Discord link endpoint * chore: Add logging for Discord ID addition in admin Discord link endpoint * chore: Remove unnecessary code in handleAdminDiscordLink function * chore: Update logging format in handleAdminDiscordLink function * chore: Refactor handleAdminDiscordLink function for improved logging * chore: Update Discord Bot Token and Discord Guild ID flags in server configuration * chore: Refactor handleAccountInfo function for improved readability and error handling * chore: Update server configuration flags for Discord Bot Token and Guild ID * Refactor handleAdminDiscordLink function for improved error handling and logging * feat: Add "Helper" role to Discord admin check for enhanced access control
44 lines
1.4 KiB
Go
44 lines
1.4 KiB
Go
/*
|
|
Copyright (C) 2024 Pagefault Games
|
|
|
|
This program is free software: you can redistribute it and/or modify
|
|
it under the terms of the GNU Affero General Public License as published by
|
|
the Free Software Foundation, either version 3 of the License, or
|
|
(at your option) any later version.
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
GNU Affero General Public License for more details.
|
|
|
|
You should have received a copy of the GNU Affero General Public License
|
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
*/
|
|
|
|
package account
|
|
|
|
import (
|
|
"github.com/pagefaultgames/rogueserver/db"
|
|
)
|
|
|
|
type InfoResponse struct {
|
|
Username string `json:"username"`
|
|
DiscordId string `json:"discordId"`
|
|
GoogleId string `json:"googleId"`
|
|
LastSessionSlot int `json:"lastSessionSlot"`
|
|
HasAdminRole bool `json:"hasAdminRole"`
|
|
}
|
|
|
|
// /account/info - get account info
|
|
func Info(username string, discordId string, googleId string, uuid []byte, hasAdminRole bool) (InfoResponse, error) {
|
|
slot, _ := db.GetLatestSessionSaveDataSlot(uuid)
|
|
response := InfoResponse{
|
|
Username: username,
|
|
LastSessionSlot: slot,
|
|
DiscordId: discordId,
|
|
GoogleId: googleId,
|
|
HasAdminRole: hasAdminRole,
|
|
}
|
|
return response, nil
|
|
}
|