Initial Setup

imgbot
kieranrobson 2022-05-10 01:17:25 +01:00
parent a2b00f6624
commit 02c266919e
10 changed files with 322 additions and 0 deletions

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
config.json

33
commands/fun/8ball.js Normal file
View File

@ -0,0 +1,33 @@
const { Message, Client, MessageEmbed } = require("discord.js");
module.exports = {
name: "8ball",
aliases: ['8b'],
/**
*
* @param {Client} client
* @param {Message} message
* @param {String[]} args
*/
run: async (client, message, args) => {
const Responses = [
"Yes",
"No",
"Maybe",
"It is likely",
"It is unlikely"
];
let messageArgs = args.join(' ');
if (!messageArgs[1]) return message.reply('Please specify a topic.');
const embed = new MessageEmbed()
.setColor('ORANGE')
.setFooter(`Called By: ${message.author.tag}`)
.setTimestamp()
.setTitle("8Ball")
.addField(`${messageArgs}`,`${Responses[Math.floor(Math.random() * Responses.length)]}`)
message.channel.send({ embeds: [embed] })
},
};

View File

@ -0,0 +1,55 @@
const { Message, Client, MessageEmbed } = require("discord.js");
const discord = require('discord.js')
module.exports = {
name: "suggestion",
aliases: ['suggest'],
/**
*
* @param {Client} client
* @param {Message} message
* @param {String[]} args
*/
run: async (client, message, args) => {
if(message.guild && message.guild.id === '744586833135927366')
{
const suggestChannel = client.channels.cache.get('858348481412726794')
let messageArgs = args.join(' ');
const threadAuthor = message.member.displayName;
const embed = new discord.MessageEmbed()
.setColor('ORANGE')
.setFooter(`Called By: ${message.author.tag}`)
.setTimestamp()
.setAuthor(message.author.tag, message.author.displayAvatarURL({ dynamic: true }))
.setDescription(messageArgs);
suggestChannel.send({ embeds: [embed] }).then((msg) =>{
msg.react('<:upvote:881547644672024607>');
msg.react('<:downvote:881547582650851330>');
msg.startThread({
name: `${threadAuthor} - ${messageArgs}`,
autoArchiveDuration: 60,
type: 'GUILD_PUBLIC_THREAD'
});
message.delete();
message.channel.send('Your suggestion has been sent to: <#858348481412726794>')
}).catch((err)=>{
throw err;
});
}
else
{
message.reply("That is not available within this server")
}
}
}

103
commands/info/help.js Normal file
View File

@ -0,0 +1,103 @@
const discord = require("discord.js");
module.exports = {
name: "help",
aliases: [''],
/**
*
* @param {Client} client
* @param {Message} message
* @param {String[]} args
*/
run: async (client, message, args) => {
if(!args[0]){
const embed = new discord.MessageEmbed()
.setTitle("Clarence Help")
.setDescription("You can use `-help <category>` to get additional commands within a specfic category")
.setColor('ORANGE')
.addField('❓`-help`','This Command', true)
.addField('🎉`-help admin`','Displays Admin Commands!', true)
.addField('`-help general`', 'Displays General Commands', true)
.addField('`-help info`', 'Displays Information Commands', true)
.addField('🎉`-help fun`','Fun Commands!', true)
.addField('🔫`-help siege`', 'Displays Siege Commands', true)
message.channel.send({ embeds: [embed] });
}
if(args[0] === 'admin'){
const embed = new discord.MessageEmbed()
.setTitle("Admin Commands")
.setColor('ORANGE')
.addField('-ban','Bans a user from the server')
.addField('-clear', 'Clears x ammount of messages')
.addField('-kick', 'Kicks a user from the server')
.addField('-mute', 'Mutes a user')
message.channel.send({ embeds: [embed] });
}
if(args[0] === 'fun'){
const embed = new discord.MessageEmbed()
.setTitle("Fun Commands")
.setColor('ORANGE')
.addField('-8ball', 'Answer your darkest questions')
.addField('-bonk','Go to horny jail!')
.addField('-cookie','Give a cookie to someone')
.addField('-icarly', 'The lyrics of the greatest song ever')
.addField('-mega', 'A mega pint?')
.addField('-bong', 'Hit up some friends and hit a bong')
//.addField('-ah', 'ah')
//.addField('-image', 'Search Google Images For An Image')
//.addField('-flip', 'Flip a coin')
message.channel.send({ embeds: [embed] });
}
if(args[0] === 'siege'){
const embed = new discord.MessageEmbed()
.setTitle("Siege Commands")
.setColor('ORANGE')
.addField('-limb', 'Displays limb damage per operator')
.addField('-muzzle','Displays muzzle attachments For all weapons')
.addField('-buy','A link to buy siege for cheap')
message.channel.send({ embeds: [embed] });
}
if(args[0] === 'general'){
const embed = new discord.MessageEmbed()
.setTitle("General Comamnds")
.setColor('ORANGE')
.addField('-addemoji', 'Adds emoji to the server')
.addField('-jumbo', 'Enalrges an emoji')
.addField('-avatar', 'Gets a users avatar')
.addField('-translate', 'Translates messages to english')
message.channel.send({ embeds: [embed] });
}
if(args[0] === 'info'){
const embed = new discord.MessageEmbed()
.setTitle("Information Commands")
.setColor('ORANGE')
.addField('-ping','Displays the ping')
.addField('-channelinfo', 'Dispalys information about a certain channel')
.addField('-userinfo', 'Dispalys information about a certain user')
message.channel.send({ embeds: [embed] });
}
}
}

31
commands/info/ping.js Normal file
View File

@ -0,0 +1,31 @@
const { Message, Client, MessageEmbed } = require("discord.js");
module.exports = {
name: "ping",
aliases: ['p'],
/**
*
* @param {Client} client
* @param {Message} message
* @param {String[]} args
*/
run: async (client, message, args) => {
let days = Math.floor(client.uptime / 86400000);
let hours = Math.floor(client.uptime / 3600000) % 24;
let minutes = Math.floor(client.uptime / 60000) % 60;
let seconds = Math.floor(client.uptime / 1000) % 60;
const embed = new MessageEmbed()
.setColor('ORANGE')
.setFooter(`Called By: ${message.author.tag}`)
.setTimestamp()
.setTitle("Ping")
.setDescription(`${client.ws.ping} ping to host`)
.addField('Uptime', ` ${days}days ${hours}hrs ${minutes}min ${seconds}sec`, true)
message.channel.send({ embeds: [embed] })
},
};

15
events/guildMemberAdd.js Normal file
View File

@ -0,0 +1,15 @@
const { Permissions } = require('discord.js');
const client = require("../index");
const discord = require('discord.js');
client.on('guildMemberAdd', async guildmember =>{
const guild = client.guilds.cache.get('427865794467069962');
if(guild == guildmember.guild.id )
{
welcomechannel.send(`<:hi:858281121611513897> Welcome! **${guildmember.user}** has just joined the server! Grab some roles from: `);
}
})

21
events/messageCreate.js Normal file
View File

@ -0,0 +1,21 @@
const client = require("../index");
const config = require("../config.json");
client.on("messageCreate", async (message) => {
if (
message.author.bot ||
!message.guild ||
!message.content.toLowerCase().startsWith(config.prefix)
)
return;
const [cmd, ...args] = message.content
.slice(config.prefix.length)
.trim()
.split(/ +/g);
const command = client.commands.get(cmd.toLowerCase()) || client.commands.find(c => c.aliases?.includes(cmd.toLowerCase()));
if (!command) return;
await command.run(client, message, args);
});

17
events/ready.js Normal file
View File

@ -0,0 +1,17 @@
const client = require("../index");
client.on('ready', () => {
console.log('HullCSS is online')
client.user.setActivity(`-help`, {type:"WATCHING"})
const guild = client.guilds.cache.get('744586833135927366');
setInterval(() =>{
const memberCount = guild.members.cache.filter(m => !m.user.bot).size;
const channel = guild.channels.cache.get('857995452052799538');
channel.setName(`Humans: ${memberCount.toLocaleString()}`);
}, 600000);
})

27
handler/index.js Normal file
View File

@ -0,0 +1,27 @@
const { glob } = require("glob");
const { promisify } = require("util");
const { Client } = require("discord.js");
const globPromise = promisify(glob);
/**
* @param {Client} client
*/
module.exports = async (client) => {
// Commands
const commandFiles = await globPromise(`${process.cwd()}/commands/**/*.js`);
commandFiles.map((value) => {
const file = require(value);
const splitted = value.split("/");
const directory = splitted[splitted.length - 2];
if (file.name) {
const properties = { directory, ...file };
client.commands.set(file.name, properties);
}
});
// Events
const eventFiles = await globPromise(`${process.cwd()}/events/*.js`);
eventFiles.map((value) => require(value));
};

19
index.js Normal file
View File

@ -0,0 +1,19 @@
const config = require("./config.json");
const { Client, Collection } = require("discord.js");
const client = new Client({
intents: 32767,
});
module.exports = client;
// Global Variables
client.commands = new Collection();
client.slashCommands = new Collection();
//client.config = require("./config.json");
// Initializing the project
require("./handler")(client);
client.login(config.token);