mirror of https://github.com/BRAVO68WEB/shx.git
commit
c93a9821e5
|
@ -1,4 +1,4 @@
|
|||
FROM node:alpine
|
||||
FROM node:18
|
||||
|
||||
WORKDIR /usr/src/app
|
||||
|
||||
|
|
|
@ -1,8 +0,0 @@
|
|||
{
|
||||
"defaultPrefix": "b!",
|
||||
"disabledCommandCatagories": [],
|
||||
"githubLink": "https://github.com/TheNestDevs/blussymon",
|
||||
"name": "BlussyMon",
|
||||
"ownerId": "457039372009865226",
|
||||
"useShards": false
|
||||
}
|
|
@ -1,8 +0,0 @@
|
|||
{
|
||||
"MAX_PLAYLIST_SIZE": 10,
|
||||
"PREFIX": "u&",
|
||||
"PRUNING": false,
|
||||
"LOCALE": "en",
|
||||
"STAY_TIME": 30,
|
||||
"DEFAULT_VOLUME": 100
|
||||
}
|
|
@ -25,6 +25,7 @@
|
|||
"@esbuild-kit/esm-loader": "^2.5.5",
|
||||
"@types/xml2js": "^0.4.11",
|
||||
"axios": "^1.4.0",
|
||||
"bson": "^5.3.0",
|
||||
"chalk": "^5.2.0",
|
||||
"crypto-js": "^4.1.1",
|
||||
"dayjs": "^1.11.7",
|
||||
|
|
|
@ -1,65 +0,0 @@
|
|||
import { EmbedBuilder, version as discordJsVersion } from 'discord.js';
|
||||
import pidusage from 'pidusage';
|
||||
|
||||
import { version as packageVersion } from '../../../../package.json';
|
||||
import type { TextCommand } from '../../../sturctures/command';
|
||||
import { parseMsToVisibleText } from '../../../utils/formatters';
|
||||
|
||||
export const command: TextCommand = {
|
||||
data: {
|
||||
name: 'botinfo',
|
||||
description: 'Check Bot information.',
|
||||
directMessageAllowed: true,
|
||||
},
|
||||
run: async ({ message }) => {
|
||||
const apiDelayMS = Math.round(message.client.ws.ping);
|
||||
const osStats = await pidusage(process.pid);
|
||||
|
||||
const embed = new EmbedBuilder()
|
||||
.setTitle("Bot's Information")
|
||||
.setDescription(
|
||||
'Hello! I am Draconian Bot, honored to see you here. Information below is my body analysis :)'
|
||||
)
|
||||
.addFields([
|
||||
{
|
||||
name: 'Version',
|
||||
value: `\`${packageVersion}\``,
|
||||
inline: true,
|
||||
},
|
||||
{
|
||||
name: 'Discord.js',
|
||||
value: `\`${discordJsVersion}\``,
|
||||
inline: true,
|
||||
},
|
||||
{
|
||||
name: 'Node',
|
||||
value: `\`${process.version}\``,
|
||||
inline: true,
|
||||
},
|
||||
{
|
||||
name: 'CPU',
|
||||
value: `\`${Math.round(Number(osStats.cpu.toFixed(2)))}%\``,
|
||||
inline: true,
|
||||
},
|
||||
{
|
||||
name: 'Memory',
|
||||
value: `\`${Math.round(osStats.memory / (1024 * 1024))}MB\``,
|
||||
inline: true,
|
||||
},
|
||||
{
|
||||
name: 'Uptime',
|
||||
value: `\`${parseMsToVisibleText(message.client.uptime)}\``,
|
||||
inline: true,
|
||||
},
|
||||
{
|
||||
name: 'Network Delay',
|
||||
value: `\`${apiDelayMS} ms\``,
|
||||
inline: true,
|
||||
},
|
||||
]);
|
||||
|
||||
await message.reply({
|
||||
embeds: [embed],
|
||||
});
|
||||
},
|
||||
};
|
|
@ -1,188 +0,0 @@
|
|||
import dayjs from 'dayjs';
|
||||
import type { TextChannel, ThreadChannel, VoiceChannel } from 'discord.js';
|
||||
import { EmbedBuilder } from 'discord.js';
|
||||
|
||||
import type { TextCommand } from '../../../sturctures/command';
|
||||
|
||||
export const command: TextCommand = {
|
||||
data: {
|
||||
name: 'channelinfo',
|
||||
description: "Check server's channel information.",
|
||||
directMessageAllowed: false,
|
||||
},
|
||||
// eslint-disable-next-line
|
||||
run: async ({ message, args }) => {
|
||||
const { guild, channel, mentions, member } = message;
|
||||
|
||||
if (!guild || !member) return;
|
||||
|
||||
const targetNameId = args[0];
|
||||
|
||||
let targetChannel = mentions.channels.first();
|
||||
|
||||
if (!targetChannel && targetNameId) {
|
||||
const fetchedChannel = guild.channels.cache.get(targetNameId);
|
||||
if (fetchedChannel) targetChannel = fetchedChannel;
|
||||
else {
|
||||
const name = String(targetNameId).toLowerCase();
|
||||
const fetchedChannelByKW = guild.channels.cache.find(ur =>
|
||||
ur.name.toLowerCase().includes(name)
|
||||
);
|
||||
if (fetchedChannelByKW) targetChannel = fetchedChannelByKW;
|
||||
}
|
||||
}
|
||||
|
||||
if (!targetChannel) targetChannel = channel;
|
||||
|
||||
const embed = new EmbedBuilder();
|
||||
|
||||
if (targetChannel.isTextBased()) {
|
||||
const textChannel = targetChannel as TextChannel;
|
||||
|
||||
embed.setTitle(`${textChannel.name}'s information:`).addFields([
|
||||
{ name: 'ID', value: textChannel.id },
|
||||
{
|
||||
// eslint-disable-next-line
|
||||
name: 'Created on',
|
||||
// eslint-disable-next-line
|
||||
value: dayjs(textChannel.createdAt.getTime()).format('DD/MM/YYYY'),
|
||||
inline: true,
|
||||
},
|
||||
]);
|
||||
|
||||
if (textChannel.parent?.name) {
|
||||
embed.addFields([
|
||||
{
|
||||
name: 'Parent',
|
||||
value: textChannel.parent.name,
|
||||
inline: true,
|
||||
},
|
||||
]);
|
||||
}
|
||||
|
||||
embed.addFields([
|
||||
{
|
||||
name: 'Position',
|
||||
value: textChannel.rawPosition.toString(),
|
||||
inline: true,
|
||||
},
|
||||
{
|
||||
name: 'NSFW',
|
||||
value: textChannel.nsfw ? 'YES' : 'NO',
|
||||
inline: true,
|
||||
},
|
||||
{
|
||||
name: 'Viewable',
|
||||
value: textChannel.viewable ? 'YES' : 'NO',
|
||||
inline: true,
|
||||
},
|
||||
]);
|
||||
|
||||
embed.setFooter({
|
||||
iconURL: guild.iconURL() ?? '',
|
||||
text: `Shard ID: ${guild.shardId}`,
|
||||
});
|
||||
|
||||
await message.reply({
|
||||
embeds: [embed],
|
||||
});
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (targetChannel.isThread()) {
|
||||
const voiceChannel = targetChannel as ThreadChannel;
|
||||
|
||||
embed.setTitle(`${voiceChannel.name}'s information:`).addFields([
|
||||
{ name: 'ID', value: voiceChannel.id },
|
||||
{
|
||||
name: 'Created on',
|
||||
value: dayjs(voiceChannel.createdAt?.getTime()).format('DD/MM/YYYY'),
|
||||
inline: true,
|
||||
},
|
||||
]);
|
||||
|
||||
if (voiceChannel.parent?.name) {
|
||||
embed.addFields([
|
||||
{
|
||||
name: 'Parent',
|
||||
value: voiceChannel.parent.name,
|
||||
inline: true,
|
||||
},
|
||||
]);
|
||||
}
|
||||
|
||||
embed.addFields([
|
||||
{
|
||||
name: 'Joinable',
|
||||
value: voiceChannel.joinable ? 'YES' : 'NO',
|
||||
inline: true,
|
||||
},
|
||||
{
|
||||
name: 'Locked',
|
||||
value: voiceChannel.locked ? 'YES' : 'NO',
|
||||
inline: true,
|
||||
},
|
||||
]);
|
||||
|
||||
embed.setFooter({
|
||||
iconURL: guild.iconURL() ?? '',
|
||||
text: `Shard ID: ${guild.shardId}`,
|
||||
});
|
||||
|
||||
await message.reply({
|
||||
embeds: [embed],
|
||||
});
|
||||
}
|
||||
|
||||
if (targetChannel.isVoiceBased()) {
|
||||
const voiceChannel = targetChannel as unknown as VoiceChannel;
|
||||
|
||||
embed.setTitle(`${voiceChannel.name}'s information:`).addFields([
|
||||
{ name: 'ID', value: voiceChannel.id },
|
||||
{
|
||||
name: 'Created on',
|
||||
value: dayjs(voiceChannel.createdAt.getTime()).format('DD/MM/YYYY'),
|
||||
inline: true,
|
||||
},
|
||||
]);
|
||||
|
||||
if (voiceChannel.parent?.name) {
|
||||
embed.addFields([
|
||||
{
|
||||
name: 'Parent',
|
||||
value: voiceChannel.parent.name,
|
||||
inline: true,
|
||||
},
|
||||
]);
|
||||
}
|
||||
|
||||
embed.addFields([
|
||||
{
|
||||
name: 'Position',
|
||||
value: voiceChannel.rawPosition.toString(),
|
||||
inline: true,
|
||||
},
|
||||
{
|
||||
name: 'Joinable',
|
||||
value: voiceChannel.joinable ? 'YES' : 'NO',
|
||||
inline: true,
|
||||
},
|
||||
{
|
||||
name: 'Speakable',
|
||||
value: voiceChannel.speakable ? 'YES' : 'NO',
|
||||
inline: true,
|
||||
},
|
||||
]);
|
||||
|
||||
embed.setFooter({
|
||||
iconURL: guild.iconURL() ?? '',
|
||||
text: `Shard ID: ${guild.shardId}`,
|
||||
});
|
||||
|
||||
await message.reply({
|
||||
embeds: [embed],
|
||||
});
|
||||
}
|
||||
},
|
||||
};
|
|
@ -1,7 +1,6 @@
|
|||
import type { TextChannel } from 'discord.js';
|
||||
import { EmbedBuilder } from 'discord.js';
|
||||
|
||||
import config from '../../../../config/bot.json';
|
||||
import type { TextCommand } from '../../../sturctures/command';
|
||||
import { getCommandHelpInfo } from '../../../utils/cmds';
|
||||
import { callbackEmbed } from '../../../utils/messages';
|
||||
|
@ -52,7 +51,7 @@ export const command: TextCommand = {
|
|||
const commandsCatagories = client.commandsCatagories;
|
||||
|
||||
embed.setDescription(
|
||||
`Hello🙋♂️!\nOur source code: [Here](${config.githubLink})\nTurely appreciate that you are supporting us.`
|
||||
`Hello🙋♂️!\nOur source code: [Here](https://github.com/bravo68web/shx)\nTurely appreciate that you are supporting us.`
|
||||
);
|
||||
|
||||
for (const catagory of commandsCatagories) {
|
||||
|
@ -84,7 +83,7 @@ export const command: TextCommand = {
|
|||
const avatarURL = client.user.defaultAvatarURL;
|
||||
|
||||
embed.setTitle('Bot Assistance Centre').setFooter({
|
||||
text: `© ${new Date().getFullYear()} ${config.name}`,
|
||||
text: `© ${new Date().getFullYear()} SHX Bot`,
|
||||
iconURL: avatarURL,
|
||||
});
|
||||
|
||||
|
|
|
@ -11,9 +11,8 @@ export const command: TextCommand = {
|
|||
},
|
||||
run: async ({ message }) => {
|
||||
const { client } = message;
|
||||
|
||||
if (isDev || client.application.botPublic) {
|
||||
const link = `https://discord.com/api/oauth2/authorize?client_id=${client.application.id}&permissions=1636381879799&scope=applications.commands%20bot`;
|
||||
const link = `https://discord.com/api/oauth2/authorize?client_id=${client.application.id}&permissions=${process.env.PERMISSION_INTEGER}&scope=applications.commands%20bot`;
|
||||
|
||||
const embed = new EmbedBuilder().setDescription(
|
||||
`Invite to your server: [HERE](${link})`
|
||||
|
@ -22,6 +21,10 @@ export const command: TextCommand = {
|
|||
await message.reply({
|
||||
embeds: [embed],
|
||||
});
|
||||
} else {
|
||||
await message.reply({
|
||||
content: 'Sorry, I am not public yet!',
|
||||
});
|
||||
}
|
||||
},
|
||||
};
|
||||
|
|
|
@ -1,90 +0,0 @@
|
|||
import dayjs from 'dayjs';
|
||||
import { EmbedBuilder } from 'discord.js';
|
||||
|
||||
import type { TextCommand } from '../../../sturctures/command';
|
||||
|
||||
export const command: TextCommand = {
|
||||
data: {
|
||||
name: 'serverinfo',
|
||||
description: "Check server's stats and information.",
|
||||
directMessageAllowed: false,
|
||||
},
|
||||
run: async ({ message }) => {
|
||||
const { guild } = message;
|
||||
|
||||
if (!guild) return;
|
||||
|
||||
const owner = await guild.fetchOwner();
|
||||
|
||||
const embed = new EmbedBuilder()
|
||||
.setThumbnail(guild.iconURL() ?? '')
|
||||
.setTitle(`${guild.name}'s information:`)
|
||||
.addFields([
|
||||
{ name: 'Owner', value: owner.user.tag, inline: true },
|
||||
|
||||
{
|
||||
name: 'Created on',
|
||||
value: dayjs(guild.createdAt.getTime()).format('DD/MM/YYYY'),
|
||||
inline: true,
|
||||
},
|
||||
|
||||
{
|
||||
name: 'User Count',
|
||||
value: guild.memberCount.toString(),
|
||||
inline: true,
|
||||
},
|
||||
|
||||
{
|
||||
name: 'Bot Count',
|
||||
value: guild.members.cache.filter(mb => mb.user.bot).size.toString(),
|
||||
inline: true,
|
||||
},
|
||||
{
|
||||
name: 'Roles',
|
||||
value: guild.members.cache.filter(mb => mb.user.bot).size.toString(),
|
||||
inline: true,
|
||||
},
|
||||
{
|
||||
name: 'Roles',
|
||||
value: guild.roles.cache.size.toString(),
|
||||
inline: true,
|
||||
},
|
||||
{
|
||||
name: 'Emojis',
|
||||
value: guild.channels.cache.size.toString(),
|
||||
inline: true,
|
||||
},
|
||||
{
|
||||
name: 'Verification Level',
|
||||
value: guild.verificationLevel.toString(),
|
||||
inline: true,
|
||||
},
|
||||
])
|
||||
.setFooter({
|
||||
text: `Shard ID: ${guild.shardId}`,
|
||||
});
|
||||
|
||||
if (guild.description) embed.setDescription(guild.description);
|
||||
|
||||
if (guild.premiumSubscriptionCount) {
|
||||
embed.addFields([
|
||||
{
|
||||
name: 'Total Boosts',
|
||||
value: guild.premiumSubscriptionCount.toString(),
|
||||
inline: true,
|
||||
},
|
||||
]);
|
||||
}
|
||||
|
||||
if (guild.vanityURLCode) {
|
||||
const url = `https://discord.gg/${guild.vanityURLCode}`;
|
||||
embed.addFields([
|
||||
{ name: 'Vanity Invite URL', value: `[${url}](${url})` },
|
||||
]);
|
||||
}
|
||||
|
||||
await message.reply({
|
||||
embeds: [embed],
|
||||
});
|
||||
},
|
||||
};
|
|
@ -2,7 +2,6 @@ import { SlashCommandBuilder } from '@discordjs/builders';
|
|||
import type { TextChannel } from 'discord.js';
|
||||
import { EmbedBuilder } from 'discord.js';
|
||||
|
||||
import { githubLink, name as botname } from '../../../config/bot.json';
|
||||
import type { SlashCommand, TextCommand } from '../../sturctures/command';
|
||||
import { getCommandHelpInfo } from '../../utils/cmds';
|
||||
import { callbackEmbed } from '../../utils/messages';
|
||||
|
@ -29,7 +28,7 @@ export const command: SlashCommand = {
|
|||
const commandsCatagories = client.commandsCatagories;
|
||||
|
||||
embed.setDescription(
|
||||
`Hello🙋♂️!\nOur source code: [Here](${githubLink})\nTurely appreciate that you are supporting us.`
|
||||
`Hello🙋♂️!\nOur source code: [Here](https://github.com/bravo68web/shx))\nTurely appreciate that you are supporting us.`
|
||||
);
|
||||
|
||||
for (const catagory of commandsCatagories) {
|
||||
|
@ -49,7 +48,7 @@ export const command: SlashCommand = {
|
|||
const avatarURL = client.user.defaultAvatarURL;
|
||||
|
||||
embed.setTitle('Bot Assistance Centre').setFooter({
|
||||
text: `© ${new Date().getFullYear()} ${botname}`,
|
||||
text: `© ${new Date().getFullYear()} SHX Bot`,
|
||||
iconURL: avatarURL,
|
||||
});
|
||||
|
||||
|
|
|
@ -0,0 +1,35 @@
|
|||
import { SlashCommandBuilder } from '@discordjs/builders';
|
||||
import { EmbedBuilder } from 'discord.js';
|
||||
|
||||
import type { SlashCommand } from '../../sturctures/command';
|
||||
|
||||
export const command: SlashCommand = {
|
||||
slashData: new SlashCommandBuilder()
|
||||
.setName('list-apikey')
|
||||
.setDescription("List API Key's for SHX instance."),
|
||||
run: async ({ interaction }) => {
|
||||
const embed = new EmbedBuilder().setDescription(
|
||||
`**API Key for SHX instance:**`
|
||||
);
|
||||
|
||||
await interaction.reply({
|
||||
embeds: [embed],
|
||||
components: [
|
||||
{
|
||||
type: 1,
|
||||
components: [
|
||||
{
|
||||
style: 5,
|
||||
label: `Delete`,
|
||||
url: process.env.SHX_DASH_URL + '/dashboard/config',
|
||||
emoji: {
|
||||
name: `🏮`,
|
||||
},
|
||||
type: 2,
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
});
|
||||
},
|
||||
};
|
|
@ -1,6 +1,5 @@
|
|||
import type { CommandInteraction } from 'discord.js';
|
||||
|
||||
import { ownerId } from '../../config/bot.json';
|
||||
import type { DiscordEvent } from '../sturctures/event';
|
||||
import { cooldownCache } from '../utils/cache';
|
||||
import { isDev } from '../utils/constants';
|
||||
|
@ -34,7 +33,10 @@ export const event: DiscordEvent = {
|
|||
return returnOfInter('This command is not enabled to execute.');
|
||||
}
|
||||
|
||||
if (slash.data?.ownerOnly === true && user.id !== ownerId) {
|
||||
if (
|
||||
slash.data?.ownerOnly === true &&
|
||||
user.id !== process.env.DISCORD_OWNER_ID
|
||||
) {
|
||||
return returnOfInter('This command is not enabled to execute.');
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
import type { Message, PermissionResolvable, TextChannel } from 'discord.js';
|
||||
|
||||
import { ownerId } from '../../config/bot.json';
|
||||
import type { TextCommand } from '../sturctures/command';
|
||||
import type { GuildConfig } from '../sturctures/database';
|
||||
import type { DiscordEvent } from '../sturctures/event';
|
||||
|
@ -125,7 +124,11 @@ export const event: DiscordEvent = {
|
|||
return;
|
||||
}
|
||||
|
||||
if (cmdData.ownerOnly === true && author.id !== ownerId) return;
|
||||
if (
|
||||
cmdData.ownerOnly === true &&
|
||||
author.id !== process.env.DISCORD_OWNER_ID
|
||||
)
|
||||
return;
|
||||
|
||||
// Reject if dm mode while configurated to guild.
|
||||
if (!guild && !cmdData.directMessageAllowed) return;
|
||||
|
|
|
@ -11,7 +11,6 @@ import type {
|
|||
import { Routes } from 'discord-api-types/v9';
|
||||
import { glob } from 'glob';
|
||||
|
||||
import { disabledCommandCatagories } from '../../config/bot.json';
|
||||
import type { SlashCommand, TextCommand } from '../sturctures/command';
|
||||
import { isDev } from '../utils/constants';
|
||||
|
||||
|
@ -51,36 +50,32 @@ export async function loadTextCommand(client: Client) {
|
|||
|
||||
const catagory = basename(dirname(filePath));
|
||||
|
||||
const disabledCatagories: string[] = disabledCommandCatagories;
|
||||
|
||||
if (!disabledCatagories.includes(catagory)) {
|
||||
if (catagory) {
|
||||
command.data.catagory = catagory;
|
||||
if (command.data.publicLevel !== 'None') {
|
||||
if (!catagories[String(catagory)]) {
|
||||
catagories[String(catagory)] = [];
|
||||
}
|
||||
catagories[String(catagory)].push(cmdName);
|
||||
if (catagory) {
|
||||
command.data.catagory = catagory;
|
||||
if (command.data.publicLevel !== 'None') {
|
||||
if (!catagories[String(catagory)]) {
|
||||
catagories[String(catagory)] = [];
|
||||
}
|
||||
catagories[String(catagory)].push(cmdName);
|
||||
}
|
||||
}
|
||||
|
||||
if (command.data.intervalLimit) {
|
||||
const list = command.data.intervalLimit;
|
||||
if (list.minute! > list.hour! || list.hour! > list.day!) {
|
||||
throw 'Impolitic Custom Interval style!';
|
||||
}
|
||||
if (command.data.intervalLimit) {
|
||||
const list = command.data.intervalLimit;
|
||||
if (list.minute! > list.hour! || list.hour! > list.day!) {
|
||||
throw 'Impolitic Custom Interval style!';
|
||||
}
|
||||
}
|
||||
|
||||
client.commands.set(cmdName, command);
|
||||
client.commands.set(cmdName, command);
|
||||
|
||||
if (command.data.aliases) {
|
||||
for (const alias of command.data.aliases) {
|
||||
if (client.aliases.has(alias)) {
|
||||
throw new Error('Duplicated alias is found!');
|
||||
}
|
||||
// Store aliase(s) to memory if exists.
|
||||
client.aliases.set(alias, command.data.name);
|
||||
if (command.data.aliases) {
|
||||
for (const alias of command.data.aliases) {
|
||||
if (client.aliases.has(alias)) {
|
||||
throw new Error('Duplicated alias is found!');
|
||||
}
|
||||
// Store aliase(s) to memory if exists.
|
||||
client.aliases.set(alias, command.data.name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,3 +1,2 @@
|
|||
/* eslint-disable no-useless-escape */
|
||||
export const isURL =
|
||||
/^https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_\+.~#?&//=]*)/;
|
||||
/https?:\/\/(www\.)?[-a-zA-Z0-9@:%._+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_+.~#?&=]*)/;
|
||||
|
|
|
@ -14,6 +14,9 @@ const ZodEnvironmentVariables = z.object({
|
|||
DEV_GUILD_ID: z.string(),
|
||||
SHX_API_TOKEN: z.string(),
|
||||
SHX_API_URL: z.string(),
|
||||
PERMISSION_INTEGER: z.string(),
|
||||
SHX_DASH_URL: z.string(),
|
||||
DISCORD_OWNER_ID: z.string(),
|
||||
});
|
||||
|
||||
ZodEnvironmentVariables.parse(process.env);
|
||||
|
|
Loading…
Reference in New Issue