Skip to content

Commit

Permalink
[Update] with this commit all commands in the misc Category should be…
Browse files Browse the repository at this point in the history
… updated as planned in #2
  • Loading branch information
naseif committed Oct 5, 2021
1 parent a8e87c9 commit 340c184
Show file tree
Hide file tree
Showing 4 changed files with 144 additions and 1 deletion.
14 changes: 14 additions & 0 deletions commands/Misc/ping.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,20 @@
const { SlashCommandBuilder } = require("@discordjs/builders");

module.exports = {
name: "ping",
args: false,
description: "Ping the bot connection to the server",
usage: "ping",
async run(message, args, client) {
const embed = {
title: "Ping Pong!",
description: `📡 **Ping:** ${client.ws.ping}
⏱ **Latency:** ${Date.now() - message.createdTimestamp}ms.`,
color: "#9dcc37",
};

await message.channel.send({ embeds: [embed] });
},
data: new SlashCommandBuilder()
.setName("ping")
.setDescription("ping the bot connection to the server"),
Expand Down
48 changes: 48 additions & 0 deletions commands/Misc/serverstats.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,54 @@
const { SlashCommandBuilder } = require("@discordjs/builders");

module.exports = {
name: "serverstats",
aliases: ["ss"],
args: false,
description: "Shows some stats about the server",
usage: "ss || serverstats",
async run(message, args, client) {
const guild = message.guild;

const statssEmbed = {
color: "#9dcc37",
title: `${guild.name}'s Stats`,
author: {
name: `${message.member.user.username}`,
icon_url: `${message.member.user.avatarURL()}`,
},
thumbnail: {
url: `${
guild.iconURL() ? guild.iconURL() : message.member.user.avatarURL()
}`,
},
fields: [
{
name: "Members",
value: `${guild.memberCount}`,
inline: true,
},
{
name: "Owner",
value: `<@${guild.ownerId}>`,
inline: true,
},
{
name: "Created",
value: `${guild.createdAt.toUTCString()}`,
},
],
timestamp: new Date(),
};
try {
await message.channel.send({ embeds: [statssEmbed] });
} catch (err) {
client.logger(err.message, "error");
await message.channel.send(
`I was not able to fetch the server info, do I have permission ?`
);
console.error(err);
}
},
data: new SlashCommandBuilder()
.setName("serverstats")
.setDescription("Shows some stats about the server"),
Expand Down
67 changes: 66 additions & 1 deletion commands/Misc/summon.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,76 @@
const { SlashCommandBuilder } = require("@discordjs/builders");
const { Permissions } = require("discord.js");
const { embedMessage } = require("../../modules/embedSimple");
const { getGuildUserFromMention } = require("../../modules/getUserFromMention");

module.exports = {
name: "summon",
args: true,
aliases: ["sum"],
usage: "sum || summon <user>",
description: "Summons the user to your voice channel",
async run(message, args, client) {
if (!args[0])
return await message.channel.send({
embeds: [
embedMessage("#9dcc37", `You have to mention a user to summon!`),
],
});

if (!message.member.permissions.has("MOVE_MEMBERS"))
return await message.channel.send({
embeds: [
embedMessage(
"#9dcc37",
`❌ | You have no permission to summon users!`
),
],
});

const guildUser = getGuildUserFromMention(args[0], message);

if (!guildUser)
return await message.channel.send({
embeds: [
embedMessage(
"#9dcc37",
`I could not resolve the user, please make sure to mention the user!`
),
],
});

if (!guildUser.voice.channelId)
return await message.channel.send({
embeds: [
embedMessage(
"#9dcc37",
`${user.toString()} is not connected to any voice channel!`
),
],
});

try {
await guildUser.voice.setChannel(message.member.voice.channelId);
await message.channel.send({
embeds: [
embedMessage(
"#9dcc37",
`User ${guildUser.toString()} has been moved to <#${
message.member.voice.channelId
}>`
),
],
});
} catch (err) {
client.logger(err.message, "error");
return await message.channel.send(
`Something went wrong, I could not summon this user!`
);
}
},
data: new SlashCommandBuilder()
.setName("summon")
.setDescription("ping the bot connection to the server")
.setDescription("Summons the user to your voice channel")
.addUserOption((option) =>
option
.setName("user")
Expand Down
16 changes: 16 additions & 0 deletions commands/Misc/uptime.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,22 @@ const { embedMessage } = require("../../modules/embedSimple");
const { msToTime } = require("../../modules/mstoTime");

module.exports = {
name: "uptime",
aliases: ["up"],
description:
"Shows since how long the bot is online, refreshes every 24 hours!",
usage: "up || uptime",
args: false,
async run(message, args, client) {
await message.channel.send({
embeds: [
embedMessage(
"#9dcc37",
`${client.user.username}' Uptime: ${msToTime(client.uptime)}`
),
],
});
},
data: new SlashCommandBuilder()
.setName("uptime")
.setDescription("Since how long the bot is online"),
Expand Down

0 comments on commit 340c184

Please sign in to comment.