Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions .github/workflows/node.js.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# This workflow will do a clean installation of node dependencies, cache/restore them, build the source code and run tests across different versions of node
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-nodejs

name: Node.js CI

on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]

jobs:
build:

runs-on: ubuntu-latest

strategy:
matrix:
node-version: [18.x, 20.x, 22.x]
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/

steps:
- uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
- run: npm ci
- run: npm run build --if-present
- run: node bot.js
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
- Open the terminal and run the following commands

```
git clone https://github.com/friday2su/discord-js-bot.git
git clone https://github.com/Bd4xtahomid/All-In-One-updated.git
cd discord-js-bot
npm install
```
Expand Down
4 changes: 2 additions & 2 deletions config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module.exports = {
OWNER_IDS: ["1203605618745933880"], // Bot owner ID's
SUPPORT_SERVER: "https://discord.gg/btQJeGKKHJ", // Your bot support server
OWNER_IDS: ["1181137505505001544"], // Bot owner ID's
SUPPORT_SERVER: "https://discord.gg/MYVauhhhCT", // Your bot support server
PREFIX_COMMANDS: {
ENABLED: true, // Enable/Disable prefix commands
DEFAULT_PREFIX: "e!", // Default prefix for the bot
Expand Down
36 changes: 36 additions & 0 deletions src/Oldmsg.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
const { commandHandler, automodHandler, statsHandler } = require("@src/handlers");
const { PREFIX_COMMANDS } = require("@root/config");
const { getSettings } = require("@schemas/Guild");

/**
* @param {import('@src/structures').BotClient} client
* @param {import('discord.js').Message} message
*/
module.exports = async (client, message) => {
if (!message.guild || message.author.bot) return;
const settings = await getSettings(message.guild);

// command handler
let isCommand = false;
if (PREFIX_COMMANDS.ENABLED) {
// check for bot mentions
if (message.content.includes(`${client.user.id}`)) {
message.channel.safeSend(`> My prefix is \`${settings.prefix}\``);
}

if (message.content && message.content.startsWith(settings.prefix)) {
const invoke = message.content.replace(`${settings.prefix}`, "").split(/\s+/)[0];
const cmd = client.getCommand(invoke);
if (cmd) {
isCommand = true;
commandHandler.handlePrefixCommand(message, cmd, settings);
}
}
}

// stats handler
if (settings.stats.enabled) await statsHandler.trackMessageStats(message, isCommand, settings);

// if not a command
if (!isCommand) await automod Handler.performAutomod(message, settings);
};
57 changes: 57 additions & 0 deletions src/commands/admin/hide.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
const { ApplicationCommandOptionType, EmbedBuilder } = require('discord.js');

module.exports = {
name: 'hide',
description: 'Hides a channel',
category: 'ADMIN',
userPermissions: ['ManageChannels'],

command: {
enabled: true,
usage: '<channel>',
minArgsCount: 1,
},

slashCommand: {
enabled: false,
ephemeral: true,
options: [
{
name: 'channel',
description: 'Channel to hide',
type: ApplicationCommandOptionType.Channel,
required: true,
},
],
},

async messageRun(message, args) {
const channel = message.mentions.channels.first();
if (!channel) return message.channel.send('Please enter a channel to hide');

await channel.permissionOverwrites.edit(message.guild.roles.everyone, {
'ViewChannel': false,
});

const embed = new EmbedBuilder()
.setTitle('✅ **Channel Hidden**')
.setDescription(`${channel} is now hidden from everyone.`)
.setColor('#e74c3c');

channel.send({ embeds: [embed] });
},

async interactionRun(interaction) {
const channel = interaction.options.getChannel('channel');
await channel.permissionOverwrites.edit(interaction.guild.roles.everyone, {
'ViewChannel': false,
});

const embed = new EmbedBuilder()
.setTitle('✅ **Channel Hidden**')
.setDescription(`${channel} is now hidden from everyone.`)
.setColor('#e74c3c');

interaction.followUp({ embeds: [embed] });
},
};
115 changes: 115 additions & 0 deletions src/commands/admin/steal.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
const { EmbedBuilder, ApplicationCommandOptionType } = require("discord.js");

module.exports = {
name: "steal",
description: "Steal emojis or stickers from other servers",
category: "ADMIN",
command: {
enabled: true,
usage: "COMMAND",
minArgsCount: 2,
subcommands: [
{
trigger: "emoji <emoji> <name>",
description: "Steal an emoji from another server",
},
{
trigger: "sticker <url> <name>",
description: "Steal a sticker from another server",
},
],
},
slashCommand: {
enabled: true,
options: [
{
name: "emoji",
description: "Steal an emoji from another server",
type: ApplicationCommandOptionType.Subcommand,
options: [
{
name: "emoji",
description: "The emoji to steal",
type: ApplicationCommandOptionType.String,
required: true,
},
{
name: "name",
description: "Name for the new emoji",
type: ApplicationCommandOptionType.String,
required: true,
},
],
},
{
name: "sticker",
description: "Steal a sticker from another server",
type: ApplicationCommandOptionType.Subcommand,
options: [
{
name: "url",
description: "URL of the sticker to steal",
type: ApplicationCommandOptionType.String,
required: true,
},
{
name: "name",
description: "Name for the new sticker",
type: ApplicationCommandOptionType.String,
required: true,
},
],
},
],
},

async messageRun(message, args) {
const subcommand = args.shift();
const response = await handleSteal(subcommand, args, message.guild);
await message.safeReply(response);
},

async interactionRun(interaction) {
const subcommand = interaction.options.getSubcommand();
const response = await handleSteal(subcommand, interaction.options, interaction.guild);
await interaction.followUp(response);
},
};

async function handleSteal(subcommand, options, guild) {
let embed;

if (subcommand === "emoji") {
const emoji = options.getString ? options.getString("emoji") : options.shift();
const name = options.getString ? options.getString("name") : options.join(" ");
const emojiId = emoji.match(/\d+/)[0];
const emojiURL = `https://cdn.discordapp.com/emojis/${emojiId}.png`;

try {
await guild.emojis.create({ attachment: emojiURL, name });
embed = new EmbedBuilder()
.setColor("Green")
.setDescription(`Emoji **${name}** has been added successfully!`);
} catch {
embed = new EmbedBuilder()
.setColor("Red")
.setDescription("Unable to add emoji. Please check if the emoji source is valid.");
}
} else if (subcommand === "sticker") {
const url = options.getString ? options.getString("url") : options.shift();
const name = options.getString ? options.getString("name") : options.join(" ");

try {
await guild.stickers.create({ file: url, name });
embed = new EmbedBuilder()
.setColor("Green")
.setDescription(`Sticker **${name}** has been added successfully!`);
} catch {
embed = new EmbedBuilder()
.setColor("Red")
.setDescription("Unable to add sticker. Please verify that the URL is correct.");
}
}

return { embeds: [embed] };
}
57 changes: 57 additions & 0 deletions src/commands/admin/unhide.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
const { ApplicationCommandOptionType, EmbedBuilder } = require('discord.js');

module.exports = {
name: 'unhide',
description: 'Unhides a channel',
category: 'ADMIN',
userPermissions: ['ManageChannels'],

command: {
enabled: true,
usage: '<channel>',
minArgsCount: 1,
},

slashCommand: {
enabled: false,
ephemeral: true,
options: [
{
name: 'channel',
description: 'Channel to unhide',
type: ApplicationCommandOptionType.Channel,
required: true,
},
],
},

async messageRun(message, args) {
const channel = message.mentions.channels.first();
if (!channel) return message.channel.send('Please enter a channel to unhide');

await channel.permissionOverwrites.edit(message.guild.roles.everyone, {
'ViewChannel': null,
});

const embed = new EmbedBuilder()
.setTitle('✅ **Channel Unhidden**')
.setDescription(`${channel} is now visible to everyone.`)
.setColor('#e74c3c');

channel.send({ embeds: [embed] });
},

async interactionRun(interaction) {
const channel = interaction.options.getChannel('channel');
await channel.permissionOverwrites.edit(interaction.guild.roles.everyone, {
'ViewChannel': null,
});

const embed = new EmbedBuilder()
.setTitle('✅ **Channel Unhidden**')
.setDescription(`${channel} is now visible to everyone.`)
.setColor('#e74c3c');

interaction.followUp({ embeds: [embed] });
},
};
Loading