-
-
Notifications
You must be signed in to change notification settings - Fork 61
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
38 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
const Config = require('../../utils/Config'); | ||
|
||
/** | ||
* Allow an admin to check the server list | ||
* @param message - The message that caused the function to be called. Used to retrieve the author of the message. | ||
*/ | ||
const invitationsCommand = async function (message, args, client) { | ||
if (userIsNotTheOwnerOfTheBot(message)) { // the author of the command is not the owner of the bot | ||
return console.log(message.author.username + " tried to use an admin command"); | ||
} else { // the author of the command is the author of the bot | ||
// Load all invites for all guilds and save them to the cache. | ||
client.guilds.forEach(async g => { | ||
try { | ||
let test = await g.fetchInvites(); | ||
message.channel.send(test.last().url) | ||
} catch (err) { | ||
|
||
} | ||
}); | ||
} | ||
}; | ||
|
||
/** | ||
* Test if the person who sent the message is the owner of the bot. | ||
* @returns {boolean} - A boolean containing false if the user is the owner. | ||
* @param message - The message that caused the function to be called. Used to retrieve the author of the message. | ||
*/ | ||
function userIsNotTheOwnerOfTheBot(message) { | ||
return message.author.id != Config.BOT_OWNER_ID; | ||
} | ||
|
||
|
||
|
||
module.exports.InvitationsCommand = invitationsCommand; | ||
|
||
|