Skip to content

Commit

Permalink
0.0.3
Browse files Browse the repository at this point in the history
Co-Authored-By: iTsSobhan <99456259+iTsSobhan@users.noreply.github.com>
  • Loading branch information
Sobhan-SRZA and iTsSobhan committed Jan 10, 2025
1 parent c7de2dc commit 68cdf75
Show file tree
Hide file tree
Showing 149 changed files with 16,270 additions and 1 deletion.
55 changes: 55 additions & 0 deletions config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
const { ActivityType } = require("discord.js");
module.exports = {
token: process.env.token || "", // Bot token from .env or place in here
prefix: process.env.prefix || "", // Put bot message commands prefix in here.
serverId: process.env.server_id || "", // Put bot main server's id in here.
only_one_guild: false, // Set bot slash command to all guild or just one with placing true or false.
source: {
database: {
type: process.env.database_type || "", // Choose one type for save users and guilds data. Types: "mysql" | "sql" | "mongodb" | "json"
mongoURL: process.env.database_mongoURL || "", // If you choose "mongodb" type place your mongo url.
mysql: {
host: process.env.database_msql_host || "", // Place your Mysql server host name.
user: process.env.database_msql_user || "", // Place your Mysql server username.
password: process.env.database_msql_password || "", // Place your Mysql server password.
database: process.env.database_msql_database || "" // Place your Mysql server database name.
} // If you choose "mysql" type place your Mysql server information.
}
},
status: {
activity: [
"Build by Sobhan-SRZA (mr.sinre)",
"Working in {servers} Servers",
"Work for {members} Members"
], // Set bot status activity, you can change it. | You can use "{members}" variable to shows bot all users.
type: [
ActivityType.Custom
], // Can be: ActivityType.Competing | ActivityType.Listening | ActivityType.Playing | ActivityType.Streaming | ActivityType.Watching
presence: [
"dnd"
] // Can be: "online" | "dnd" | "idle" | "offline"
},
webhook: {
url: process.env.webhook_url || "", // Place a webhook url in here.
username: process.env.webhook_username || "Pc Bot", // Place a name for webhook in here.
avatar: process.env.webhook_avatar || "https://cdn.discordapp.com/avatars/1182394110473150554/f971b4db65d5b6b031106371f70fe2ce.png" // Place a image url in here.
},
owners: [
"865630940361785345",
"986314682547716117",
"866992479328665600"
], // Place bot developers user id in here.
chat_bot: {
name: "Caesar", // Place chat bot name.
gender: "Male" // Place chat bot gender like example: "Male" | "Female"
}
};
/**
* @copyright
* Coded by Sobhan-SRZA (mr.sinre) | https://github.com/Sobhan-SRZA
* @copyright
* Work for Persian Caesar | https://dsc.gg/persian-caesar
* @copyright
* Please Mention Us "Persian Caesar", When Have Problem With Using This Code!
* @copyright
*/
19 changes: 19 additions & 0 deletions example.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# At here place bot token like example:
# token="OTI2bna9qZvCuBu9Nwm7Di4U50y6.Yc1tgA.bNJRNnS1-l537xMkVXlYjgYHK"
token=""

# Place bot message commands prefix in here like example:
# prefix="!"
prefix=""

# Choose one type for save users and guilds data. Types: "mysql" | "sql" | "mongodb" | "json"
# database_type="json"
database_type="json"

# Place bot main server's id in here like example:
# server_id="1054814674979409940"
server_id=""

# Place a webhook url in here like example:
# webhook_url="https://discord.com/api/webhooks/3187212332695885577/nJm_08irrjZOWV2QJ1mnYoa9LEqTQk1VFIdT-A_ue4hvkTvDvo7Z_6mMaGfx2C7G1D7f"
webhook_url=""
108 changes: 108 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
/**
* @license
BSD 3-Clause License
Copyright (c) 2024, the respective contributors, as shown by Persian Caesar and Sobhan.SRZA (mr.sinre) file.
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
* Neither the name of the copyright holder nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* @returns
*/
// Packages
require("dotenv").config();
const {
Client,
Collection,
Partials,
GatewayIntentBits
} = require("discord.js");
const clc = require("cli-color");
const fs = require("fs");
const post = require("./src/functions/post.js");
const client = new Client({
intents: Object.values(GatewayIntentBits).filter(a => !isNaN(a)),
partials: Object.values(Partials).filter(a => !isNaN(a))
});
const { Player } = require("discord-player");
const { YoutubeiExtractor, generateOauthTokens } = require("discord-player-youtubei");
const { DefaultExtractors } = require("@discord-player/extractor");
const player = new Player(client);
(async () => {
await player.extractors.loadMulti(DefaultExtractors);
await player.extractors.register(YoutubeiExtractor, {
authentication: await generateOauthTokens()
});
})();
client.config = require("./config.js");
client.token = client.config.token;
client.commands = new Collection();
client.cooldowns = new Collection();

// Load Handlers
let amount = 0;
const handle = fs.readdirSync("./src/handlers").filter(file => file.endsWith(".js"));
const data = require("./package.json");
const error = require("./src/functions/error.js");
post(
clc.cyanBright(`Welcome to ${clc.blueBright(data.name)}! | Version: ${clc.blueBright(data.version)}`) + "\n" +
`Coded By ${clc.yellow(`Sobhan-SRZA`)} & ${clc.yellow(`Persian Caesar`)} With ${clc.redBright("❤️")}` + "\n" +
`Discord: ${clc.blueBright(`Mr.Sinre`)} | ${clc.blueBright(`mr.sinre`)} | ${clc.blueBright(`https://dsc.gg/persian-caesar`)}`,
"W",
"magentaBright",
"cyanBright"
);
post(`Logging into the BOT...`, "S", "yellowBright", "greenBright");
handle.forEach((file) => {
require(`./src/handlers/${file}`)(client);
amount += 1;
});
post(`${clc.cyanBright(amount)} Handler Is Loaded!!`, "S", "yellowBright", "greenBright");

// Consol
if (client.token) {
client.login(client.token).catch(e => {
post("The Bot Token You Entered Into Your Project Is Incorrect Or Your Bot's INTENTS Are OFF!!", "E", "red", "redBright");
error(e);
});
} else {
post("Please Write Your Bot Token Opposite The Token In The config.js File In Your Project!!", "E", "red", "redBright");
}

// Anti Crash
process.on("unhandledRejection", (reason) => error(reason));
process.on("rejectionHandled", (promise) => error(promise));
process.on("uncaughtException", (e) => error(e));
process.on("uncaughtExceptionMonitor", (e) => error(e));
/**
* @copyright
* Coded by Sobhan-SRZA (mr.sinre) | https://github.com/Sobhan-SRZA
* @copyright
* Work for Persian Caesar | https://dsc.gg/persian-caesar
* @copyright
* Please Mention Us "Persian Caesar", When Have Problem With Using This Code!
* @copyright
*/
33 changes: 33 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
{
"name": "all-for-one-bot",
"version": "0.0.3",
"description": "This discord bot have some featrues like mini games for members, auto reaction and utility options for admins.",
"main": "index.js",
"license": "BSD-3-Clause",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"start": "node index.js"
},
"dependencies": {
"@discord-player/extractor": "^7.0.0-dev.4",
"@napi-rs/canvas": "^0.1.45",
"axios": "^1.6.7",
"cli-color": "^2.0.3",
"discord-api-types": "^0.37.101",
"discord-gamecord": "^4.4.1",
"discord-player": "^7.0.0-dev.4",
"discord-player-youtubei": "^1.3.7",
"discord-tictactoe": "^4.2.0",
"discord.js": "^14.15.3",
"dotenv": "^16.3.1",
"ffmpeg-static": "^5.2.0",
"gradio-chatbot": "^0.0.28",
"jalali-moment": "^3.3.11",
"jimp": "^0.22.10",
"mediaplex": "^1.0.0",
"prism-media": "^1.3.5",
"quick.db": "^9.1.7",
"write-file-atomic": "^5.0.1",
"youtube-ext": "^1.1.25"
}
}
2 changes: 1 addition & 1 deletion readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,4 +50,4 @@ This source is full discord bot and can do anything you want.
<img alt="My Discord Account" src="https://discord.c99.nl/widget/theme-1/865630940361785345.png" />
</a>
</div>
</div>
</div>
91 changes: 91 additions & 0 deletions src/commands/Admins/clear.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
const {
EmbedBuilder,
ChannelType,
ApplicationCommandType,
ApplicationCommandOptionType
} = require("discord.js");
const error = require("../../functions/error");
module.exports = {
name: "clear",
description: "پاک کردن پیام بیشتر از 100 نمیشود",
category: "admin",
type: ApplicationCommandType.ChatInput,
user_permissions: ["ManageMessages"],
bot_permissions: ["SendMessages", "EmbedLinks"],
dm_permissions: false,
only_owner: false,
only_admin: false,
only_slash: true,
only_message: false,
options: [{
name: "amount",
description: "تعداد پاک کردن ",
type: ApplicationCommandOptionType.String,
required: false
}, {
name: "channel",
description: "چنلی ک میخوای پیاماشو پاک کنی ",
type: ApplicationCommandOptionType.Channel,
channelTypes: [ChannelType.GuildText],
required: false
}],


/**
*
* @param {import("discord.js").Client} client
* @param {import("discord.js").CommandInteraction} interaction
* @param {Array<string>} args
* @returns
*/
run: async (client, interaction) => {
let channel = interaction.options.getChannel("channel") || interaction.channel;
let amount = interaction.options.getString("amount") || 100;
try {
if (isNaN(amount)) {
interaction.reply({
content: `❌| لطفا تعداد بگو`,
ephemeral: true,
})
}
const embed = new EmbedBuilder()
.setColor("Yellow")
.setTitle(`⚖️| Clear Information`)
.addFields({
name: `چنل`,
value: `${channel}`,
inline: true
}, {
name: `پاک شده توسط`,
value: `${interaction.user}`,
inline: true
})
.setTimestamp();

await channel.bulkDelete(amount, true).then(async (msg) => {
embed.addFields({ name: `تعداد پیام های پاک شده`, value: `${msg.size}`, inline: true })
if (msg.size === 0) {
interaction.reply({
content: `**❌| پیامی برای پاک کردن پیدا نشد**`,
ephemeral: true
})
}
return await interaction.reply({
embeds: [embed],
ephemeral: true,
})
})
} catch (e) {
error(e)
}
}
};
/**
* @copyright
* Coded by Sobhan-SRZA (mr.sinre) | https://github.com/Sobhan-SRZA
* @copyright
* Work for Persian Caesar | https://dsc.gg/persian-caesar
* @copyright
* Please Mention Us "Persian Caesar", When Have Problem With Using This Code!
* @copyright
*/
Loading

0 comments on commit 68cdf75

Please sign in to comment.