0% found this document useful (0 votes)
18 views

System Bot

Uploaded by

bxxodev
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
18 views

System Bot

Uploaded by

bxxodev
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 8

const { Client, GatewayIntentBits, REST, Routes, PermissionsBitField, ChannelType,

EmbedBuilder, ActivityType } = require('discord.js');


const { SlashCommandBuilder } = require('@discordjs/builders');

const clientId = '1186705436393603102';


const guildId = '1182035134103420981';

const commands = [
new SlashCommandBuilder()
.setName('slot')
.setDescription('Create a slot channel')
.addStringOption(option =>
option
.setName('name')
.setDescription('The start of the channel name: slot-busso slot- is the
name')
.setRequired(true)
)
.addUserOption(option =>
option
.setName('user')
.setDescription('User to mention')
.setRequired(true)
)
.addStringOption(option =>
option
.setName('expiration')
.setDescription('Expiration example: lifetime')
.setRequired(true)
)
.addStringOption(option =>
option
.setName('pings')
.setDescription('Pings example: 2x everyone')
.setRequired(true)
)
.addStringOption(option =>
option
.setName('categoryid')
.setDescription('Category ID')
.setRequired(true)
),

new SlashCommandBuilder()
.setName('sendembed')
.setDescription('sends an embed')
.setDefaultMemberPermissions(PermissionsBitField.BanMembers)
.addStringOption(option =>
option
.setName('title')
.setDescription('title of the embed')
.setRequired(true))
.addStringOption(option =>
option
.setName("description")
.setDescription("the description of the embed")
.setRequired(true))
.addChannelOption(option =>
option
.setName("channel")
.setDescription("the channel where to send the embed")
.setRequired(true)),

new SlashCommandBuilder()
.setName("memberscount")
.setDescription("sends the amount of the members that are in the server"),

new SlashCommandBuilder()
.setName("ping")
.setDescription("Shows The Current Ms Of The Bot"),

new SlashCommandBuilder()
.setName("support-server")
.setDescription("shows the link of the support discord server!"),

new SlashCommandBuilder()
.setName("addrole")
.setDescription("adds a role to an user")
.addRoleOption(option => option
.setName("role")
.setDescription("the Role to add ")
.setRequired(true))
.addUserOption(option => option
.setName("user")
.setDescription("The User To add The role")
.setRequired(true)),

new SlashCommandBuilder()
.setName('productsend')
.setDescription('Send a product information')
.addUserOption(option =>
option
.setName('user')
.setDescription('User to send the product information')
.setRequired(true)
)
.addStringOption(option =>
option
.setName('product')
.setDescription('Product information')
.setRequired(true)
)
.addStringOption(option =>
option
.setName('thanksmessage')
.setDescription('Thanks message')
.setRequired(false)
),

new SlashCommandBuilder()
.setName('avatar')
.setDescription('Show the avatar of a user')
.addUserOption(option =>
option
.setName('user')
.setDescription('The user to show the avatar')
.setRequired(true)),

new SlashCommandBuilder()
.setName('free-premium')
.setDescription('tutorial on how to get free premium access'),

new SlashCommandBuilder()
.setName('percentage')
.setDescription('Calculate the percentage')
.addNumberOption(option =>
option.setName('percentage')
.setDescription('The Percentage You Want To calculate, Like: 10% (insert only
the number like 10 not 10%')
.setRequired(true))
.addNumberOption(option =>
option.setName('number')
.setDescription('The Number To Calculate The Percentage like 529 so 10% of
529 for example')
.setRequired(true)),

].map(command => command.toJSON());

const rest = new REST({ version:


'9' }).setToken('MTE4NjcwNTQzNjM5MzYwMzEwMg.Gdq7pc.zpqQSIOHerZpeSnlm32IAD-
NrKKZX_zVuU3yOc');

(async () => {
try {
console.log('Started refreshing application (/) commands.');

await rest.put(
Routes.applicationCommands(clientId),
{ body: commands },
);

console.log('Successfully reloaded application (/) commands.');


} catch (error) {
console.error(error);

rest.delete(Routes.applicationCommand(clientId, '1188497566346793051'))
.then(() => console.log('Successfully deleted application command'))
.catch(console.error);
}
})();

const client = new Client({


intents: [GatewayIntentBits.Guilds, GatewayIntentBits.GuildMessages],
});

const statusChannelId = '1188522825661808681'; // Replace with your channel ID


const statusMessageId = '1191859708596846774'; // Replace with your status message
ID

const updateStatusMessage = async () => {


const ping = `${client.ws.ping}ms`;
const embed = new EmbedBuilder()
.setTitle('BOT STATUS')
.setDescription(`Ping: ${ping}\nService: ✅\nAnti-DDoS: ✅`)
.setColor(0x000000)
.setTimestamp();

try {
const channel = client.channels.cache.get(statusChannelId);
const message = await channel.messages.fetch(statusMessageId);
message.edit({ embeds: [embed] });
} catch (error) {
console.error('Error updating status message:', error);
}
};

client.on('ready', () => {
console.log(`Logged in as ${client.user.tag}`);
client.user.setActivity({
name: "#1 SHOP BOT",
type: ActivityType.Game
});

// Uncomment the line below if you want to update the status message on bot
startup
updateStatusMessage();

setInterval(updateStatusMessage, 2 * 60 * 1000);
});

client.on('interactionCreate', async (interaction) => {


if (!interaction.isCommand()) return;

const { commandName, options, guild } = interaction;

if (interaction.commandName === 'slot') {


const name = options.getString('name');
const user = options.getUser('user');
const categoryID = options.getString('categoryid') || 'DEFAULT_CATEGORY_ID';
const expiration = options.getString('expiration');
const pings = options.getString('pings');

const channel = await guild.channels.create({


name: (`${name}${user.username}`),
type: ChannelType.GuildText,
parent: categoryID,
permissionOverwrites: [
{
id: interaction.guild.id,
deny: [PermissionsBitField.Flags.SendMessages],
},
{
id: user.id,
allow: [PermissionsBitField.Flags.SendMessages]
},
// Consentire al proprietario dello slot di menzionare chiunque
{
id: user.id,
allow: [PermissionsBitField.Flags.MentionEveryone]
}
],
});
const embed = new EmbedBuilder()
.setColor(0x000000)
.setTitle('PURCHASE INFORMATIONS:')
.setThumbnail(user.displayAvatarURL())
.addFields(
{ name: '**SLOT OWNER:**', value: `${user.tag}` },
{ name: '**EXPIRATION:**', value: `${expiration}` },
{ name: '**PINGS:**', value: `${pings}` },
)
.setTimestamp()
.setFooter({ text: 'Powered By OS Devs', iconURL:
'https://cdn.discordapp.com/attachments/1136960027454877778/1185539625628995664/
image.png?
ex=658ffad1&is=657d85d1&hm=f466da2a07c17139247907043f31add8e3c4d252c924927b27e624ab
4553d501&' });

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

await interaction.reply(`Succesfully created slot: ${channel}`);


}

if (interaction.commandName === 'sendembed') {


const title = options.getString('title');
const desc = options.getString("description")
const channel2 = options.getChannel('channel');

const embed2 = new EmbedBuilder()


.setTitle(`${title}`)
.setDescription(`${desc}`)
.setColor(0x000000)
.setTimestamp()
.setFooter({ text: "Powered By OS Devs", iconURL:
"https://cdn.discordapp.com/attachments/1136960027454877778/1185539625628995664/
image.png?
ex=658ffad1&is=657d85d1&hm=f466da2a07c17139247907043f31add8e3c4d252c924927b27e624ab
4553d501&" });

channel2.send({ embeds: [embed2] });

await interaction.reply("succesfully sent embed");


}

if (interaction.commandName === 'memberscount') {


const guild = interaction.guild;
const memberCount = guild.memberCount
const embed3 = new EmbedBuilder()
.setTitle("MEMBERS COUNT")
.setDescription(`${memberCount}`)
.setColor(0x000000)
.setTimestamp()

interaction.reply({ embeds: [embed3] });


}

if (interaction.commandName === 'ping') {


const embed4 = new EmbedBuilder()
.setTitle("🏓 PONG!")
.setDescription(`${client.ws.ping}ms!`)
.setColor(0x000000)
.setTimestamp()

interaction.reply({ embeds: [embed4] });


}

if (interaction.commandName === 'addrole') {


const role = options.getRole("role");
const member = options.getMember("user", interaction.guild);

if (!role || !member) {
return interaction.reply({ content: 'Invalid role or member.', ephemeral:
true });
}

if (!interaction.member.permissions.has(PermissionsBitField.Flags.ManageRoles))
{
return interaction.reply({ content: 'You do not have permission to manage
roles', ephemeral: true });
}

try {
await member.roles.add(role);
interaction.reply({ content: `Role ${role.name} added to $
{member.user.username}.`, ephemeral: true });
} catch (error) {
console.error('Error adding role:', error);
interaction.reply({ content: 'An error occurred while adding the role.',
ephemeral: true });
}
}

if (interaction.commandName === 'roleremove') {


const role = options.getRole("role");
const member = options.getMember("user", interaction.guild);

if (!role || !member) {
return interaction.reply({ content: 'Invalid role or member.', ephemeral:
true });
}

if (!interaction.member.permissions.has(PermissionsBitField.Flags.ManageRoles))
{
return interaction.reply({ content: 'You do not have permission to manage
roles', ephemeral: true });
}

try {
await member.roles.remove(role);
interaction.reply({ content: `Role ${role.name} removed from $
{member.user.username}.`, ephemeral: true });
} catch (error) {
console.error('Error removing role:', error);
interaction.reply({ content: 'An error occurred while removing the role.',
ephemeral: true });
}
}

if (interaction.commandName === 'productsend') {


if (!interaction.member.permissions.has(PermissionsBitField.Flags.ManageRoles))
{
return interaction.reply({ content: 'You Need To Have Role Management
Permission!', ephemeral: true });
}

const user = options.getUser('user');


const product = options.getString('product');
const thanksMessage = options.getString('thanksmessage') || 'No thanks message
provided';

user.send({
embeds: [new EmbedBuilder()
.setTitle(`PRODUCT FROM ${guild.name}`)
.setDescription(thanksMessage)
.setColor(0x000000)
.setTimestamp()
.setFooter({ text: 'Powered By OS Devs', iconURL:
'https://cdn.discordapp.com/attachments/1136960027454877778/1185539625628995664/
image.png?
ex=658ffad1&is=657d85d1&hm=43f31add8e3c4d2c924927b27e624ab4f466da2a07c1713924790705
2553d501&' }),
],
});

await interaction.reply(`Successfully sent product information to $


{user.tag}.`);

user.send(`Here are your products: ${product}`);


}

if (commandName === 'avatar') {


const user = options.getUser('user') || interaction.user;

const embed = new EmbedBuilder()


.setColor(0x000000)
.setTitle(`${user.tag}'s Avatar`)
.setImage(user.displayAvatarURL({ dynamic: true, size: 2048 }))
.setTimestamp();

interaction.reply({ embeds: [embed] });


}

if (commandName === 'free-premium') {

const embed9 = new EmbedBuilder()


.setColor(0x000000)
.setTitle(`HOW TO GET FREE PREMIUM!`)
.setDescription("to get free premium you must join our official discord
server: https://discord.gg/osdevs\n and for last part vote us here:
https://top.gg/bot/1186705436393603102/vote")
.setTimestamp();

interaction.reply({ embeds: [embed9] });

}
if (interaction.commandName === 'percentage') {
const percentage = interaction.options.getNumber('percentage');
const number = interaction.options.getNumber('number');

if (isNaN(percentage) || isNaN(number)) {
return interaction.reply({ content: 'Invalid input. Please provide valid
numbers.', ephemeral: true });
}

const result = (percentage / 100) * number;

const embed = new EmbedBuilder()


.setTitle('Percentage Calculation')
.setDescription(`The result is: ${result}`)
.setTimestamp()
.setFooter({ text: 'Powered By OS Devs', iconURL:
'https://cdn.discordapp.com/attachments/1136960027454877778/1185539625628995664/
image.png?
ex=658ffad1&is=657d85d1&hm=43f31add8e3c4d2c924927b27e624ab4f466da2a07c1713924790705
2553d501&' })
interaction.reply({ embeds: [embed] });
}
});

client.login('MTE4NjcwNTQzNjM5MzYwMzEwMg.Gdq7pc.zpqQSIOHerZpeSnlm32IAD-
NrKKZX_zVuU3yOc');

You might also like