Basic User and Guild registration
This commit is contained in:
24
commands/userlist.js
Normal file
24
commands/userlist.js
Normal file
@@ -0,0 +1,24 @@
|
||||
const { SlashCommandBuilder } = require("@discordjs/builders");
|
||||
const { User } = require("../models");
|
||||
|
||||
|
||||
module.exports = {
|
||||
data: new SlashCommandBuilder()
|
||||
.setName("userlist")
|
||||
.setDescription("List all users"),
|
||||
async execute(interaction) {
|
||||
let users = await User.findAll();
|
||||
let userList = "";
|
||||
for (let i = 0; i < users.length; i++) {
|
||||
let username = await interaction.client.users.fetch(users[i].userID);
|
||||
userList += `${username.username}#${username.discriminator}`;
|
||||
}
|
||||
if (userList === "") {
|
||||
userList = "No users found";
|
||||
}
|
||||
interaction.reply({
|
||||
content: userList,
|
||||
ephemeral: false
|
||||
});
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user