- Server can now choose from IDs in the DB - Implemented an active system to disable some IDs from being used
This commit is contained in:
@@ -93,11 +93,32 @@ export const checkIfDiscordVCConnected = async (guildId) => {
|
||||
* Get the username of the bot in a given guild
|
||||
* (there may be a server nickname given to the bot in a certain guild)
|
||||
* @param {string} guildId The guild id to check the connection status in
|
||||
* @returns {string} The username of the bot in the given guild's CV
|
||||
* @returns {string} The username of the bot in the given guild's VC
|
||||
*/
|
||||
export const getDiscordUsername = async (guildId) => {
|
||||
console.log("Requested username");
|
||||
if (activeDiscordClient) return (activeDiscordClient.user.username);
|
||||
if (activeDiscordClient) {
|
||||
// Fetch the guild
|
||||
const guild = await client.guilds.fetch(guildId);
|
||||
|
||||
// Fetch the bot member in the guild
|
||||
const botMember = await guild.members.fetch(client.user.id);
|
||||
|
||||
// Return bot's nickname if available, otherwise return username
|
||||
return botMember.nickname || botMember.user.username;
|
||||
}
|
||||
else return (undefined);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the ID of the currently running bot
|
||||
* @returns {string} The ID of the active client
|
||||
*/
|
||||
export const getDiscordID = async () => {
|
||||
console.log("Requested username");
|
||||
if (activeDiscordClient) {
|
||||
return (activeDiscordClient.user.id);
|
||||
}
|
||||
else return (undefined);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user