first commit probably lots of errors
This commit is contained in:
commit
ec94c2080b
99 changed files with 10227 additions and 0 deletions
119
src/bot/commands/fun/fivem.js
Normal file
119
src/bot/commands/fun/fivem.js
Normal file
|
@ -0,0 +1,119 @@
|
|||
const http = require('http');
|
||||
const conf = require('../../../conf/conf.json')
|
||||
module.exports = {
|
||||
name: 'fivem-disables',
|
||||
description: "`.fivem` gets information for the fivem server. do `.fivem players` to see who is online",
|
||||
async execute(message, args, Discord, currentServer, messageUser, client) {
|
||||
const url = "http://lxn4gvp-aries1.linuxnodes.net:3000"
|
||||
|
||||
if (!args[1]) {
|
||||
let serverEmbed = new Discord.MessageEmbed()
|
||||
.setAuthor("fiveM info")
|
||||
.setColor(conf.colour.ok)
|
||||
.setDescription("some info about the server")
|
||||
try {
|
||||
await http.get(`${currentServer.configs.fivem.url}/dynamic.json`, (result) => {
|
||||
let body = ''
|
||||
result.on('data', (chunk) => {
|
||||
body += chunk
|
||||
})
|
||||
result.on('end', () => {
|
||||
let dynamicResponse = JSON.parse(body)
|
||||
serverEmbed.addField(`__**players:**__`, `${dynamicResponse.clients}/${dynamicResponse.sv_maxclients}`, true)
|
||||
|
||||
|
||||
}).on('error', function(error) {
|
||||
console.log('error: ' + error)
|
||||
})
|
||||
})
|
||||
|
||||
await http.get(`${currentServer.configs.fivem.url}/info.json`, (result) => {
|
||||
let body = ''
|
||||
result.on('data', (chunk) => {
|
||||
body += chunk
|
||||
})
|
||||
result.on('end', () => {
|
||||
let infoResponse = JSON.parse(body)
|
||||
|
||||
serverEmbed.addField(`__**server:**__`, `${infoResponse.server}`, true)
|
||||
|
||||
let oneEyncEnabled;
|
||||
let enhancedHostSupport;
|
||||
let scriptHookAllowed;
|
||||
if (infoResponse.vars.onesync_enabled == 'true') {
|
||||
oneEyncEnabled = ":white_check_mark:"
|
||||
} else {
|
||||
oneEyncEnabled = ":x:"
|
||||
}
|
||||
|
||||
if (infoResponse.vars.sv_enhancedHostSupport == 'true') {
|
||||
enhancedHostSupport = ":white_check_mark:"
|
||||
} else {
|
||||
enhancedHostSupport = ":x:"
|
||||
}
|
||||
|
||||
if (infoResponse.vars.sv_scriptHookAllowed == 'true') {
|
||||
scriptHookAllowed = ":white_check_mark:"
|
||||
} else {
|
||||
scriptHookAllowed = ":x:"
|
||||
}
|
||||
|
||||
serverEmbed.addField(`__**server Info:**__`, ` __onesync:__ ${infoResponse.vars.onesync} \n __onesync Enabled:__ ${oneEyncEnabled} \n __Enhanced Host Support:__ ${enhancedHostSupport} \n __Script Hook Allowed:__ ${scriptHookAllowed}`)
|
||||
serverEmbed.addField(`__**resources:**__`, `${infoResponse.resources}`)
|
||||
|
||||
message.channel.send(serverEmbed)
|
||||
})
|
||||
})
|
||||
} catch (error) {
|
||||
message.reply("__**there has been an error**__\nserver is down maybe.")
|
||||
console.log('error: ' + error)
|
||||
}
|
||||
|
||||
} else if (args[1] == 'ip') {
|
||||
let fivemIpEmbed = new Discord.MessageEmbed()
|
||||
.setAuthor("fiveM ip")
|
||||
.setColor(conf.colour.ok)
|
||||
.setDescription("the fiveM server ip is: `" + currentServer.conf.fivem.ip + "`")
|
||||
message.channel.send(fivemIpEmbed)
|
||||
} else if (args[1] == 'players') {
|
||||
let playersEmbed = new Discord.MessageEmbed()
|
||||
.setAuthor("fiveM players")
|
||||
.setColor(conf.colour.ok)
|
||||
|
||||
try {
|
||||
http.get(`${currentServer.configs.fivem.url}/players.json`, (result) => {
|
||||
let body = ''
|
||||
result.on('data', (chunk) => {
|
||||
body += chunk
|
||||
})
|
||||
|
||||
result.on('end', () => {
|
||||
var response = JSON.parse(body)
|
||||
if (response.length == 0 || response.length < 0) {
|
||||
playersEmbed.addField("__info__", `no one is on the server`)
|
||||
}
|
||||
|
||||
let i;
|
||||
for (i = 0; i < response.length; i++) {
|
||||
playersEmbed.addField(`player ${i}:`, `__**name:**__ ${response[i].name} \n __**discord:**__ <@!${response[i].identifiers[3].replace('discord:', '')}> \n __**fiveM id:**__ ${response[i].id} \n __**ping:**__ ${response[i].ping} \n`)
|
||||
}
|
||||
if (i == response.length) {
|
||||
try {
|
||||
message.channel.send(playersEmbed)
|
||||
} catch (error) {
|
||||
message.channel.send("i couldnt sent that maybe there are too many players online and i cant add them all to the embed.")
|
||||
console.log('error: ' + error)
|
||||
}
|
||||
}
|
||||
|
||||
}).on('error', function(error) {
|
||||
console.log('error: ' + error)
|
||||
})
|
||||
})
|
||||
} catch (error) {
|
||||
message.reply("__**there has been an error**__\nserver is down maybe.")
|
||||
console.log('error: ' + error)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
35
src/bot/commands/fun/mcstat.js
Normal file
35
src/bot/commands/fun/mcstat.js
Normal file
|
@ -0,0 +1,35 @@
|
|||
const Discord = require('discord.js');
|
||||
const util = require('minecraft-server-util');
|
||||
|
||||
|
||||
module.exports = {
|
||||
name: 'mcstatus',
|
||||
description: "mcstat",
|
||||
execute(message, args, Discord, currentServer, messageUser, client) {
|
||||
|
||||
|
||||
util.status('cwh11.mc.sparks.codes' || currentServer.conf.mc)
|
||||
.then((response) => {
|
||||
let minecraftEmbed = new Discord.MessageEmbed()
|
||||
.setColor(conf.colour.ok)
|
||||
.setAuthor(conf.bot.name, conf.bot.logo)
|
||||
.setTitle('Minecraft server status')
|
||||
.setURL('http://cwh11.mc.sparks.codes')
|
||||
.setThumbnail(`${message.guild.iconURL() || `${conf.domain}/logo.png`}`)
|
||||
.setDescription('its online!')
|
||||
.addField('Server IP:', `${response.host}`)
|
||||
.addField('Version:', `${response.version}`)
|
||||
.addField('MOTD:', `${response.description.descriptionText}`)
|
||||
.addFields({ name: 'Online Players', value: `${response.onlinePlayers}`, inline: true }, { name: 'Max Players', value: `${response.maxPlayers}`, inline: true }, )
|
||||
.setTimestamp()
|
||||
.setFooter(`Requested by ${message.member.displayName}`, `${message.author.displayAvatarURL()}`);
|
||||
|
||||
message.channel.send(minecraftEmbed).catch(error => console.log('error: ' + error));
|
||||
|
||||
})
|
||||
.catch((error) => {
|
||||
console.log('error: ' + error);
|
||||
message.channel.send('**there has been a error**\n this is probably because the server is down');
|
||||
});
|
||||
}
|
||||
}
|
55
src/bot/commands/fun/memes.js
Normal file
55
src/bot/commands/fun/memes.js
Normal file
|
@ -0,0 +1,55 @@
|
|||
const https = require('https');
|
||||
const conf = require('../../../conf/conf.json')
|
||||
module.exports = {
|
||||
name: 'memes',
|
||||
description: " shrekbot meme command http://shrekbot.tk/github",
|
||||
execute(message, args, Discord, currentServer, messageUser, client) {
|
||||
try {
|
||||
const url = `https://www.reddit.com/${currentServer.configs.memes || 'r/memes'}/.json?limit=200`
|
||||
|
||||
https.get(url, (result) => {
|
||||
var body = ''
|
||||
result.on('data', (chunk) => {
|
||||
body += chunk
|
||||
})
|
||||
|
||||
result.on('end', () => {
|
||||
var response = JSON.parse(body)
|
||||
var index = response.data.children[Math.floor(Math.random() * 129) + 1].data
|
||||
|
||||
if (index.post_hint !== 'image') {
|
||||
message.channel.send('there has been a shrekup retrying...')
|
||||
}
|
||||
|
||||
if (!index.preview) return message.channel.send('a big shrekup has hapened do that command agian');
|
||||
|
||||
var image = index.preview.images[0].source.url.replace('&', '&')
|
||||
var title = index.title
|
||||
var link = 'https://reddit.com' + index.permalink
|
||||
var subRedditName = index.subreddit_name_prefixed
|
||||
|
||||
if (index.post_hint !== 'image') {
|
||||
console.log("error no image")
|
||||
}
|
||||
|
||||
console.log(image);
|
||||
|
||||
const imageembed = new Discord.MessageEmbed()
|
||||
.setTitle('a meme provided by reddit')
|
||||
.setImage(image)
|
||||
.setColor(`${conf.colour.ok}`)
|
||||
.setDescription(`[${title}](${link})`)
|
||||
//.setURL(`https://reddit.com/${subRedditName}`)
|
||||
.setFooter('powered by ' + `${subRedditName}`)
|
||||
message.channel.send(imageembed).catch(error => console.log('error: ' + error))
|
||||
|
||||
}).on('error', function(error) {
|
||||
console.log('Got an error: ' + error);
|
||||
})
|
||||
})
|
||||
} catch (error) {
|
||||
console.log('error: ' + error);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
203
src/bot/commands/fun/play.js
Normal file
203
src/bot/commands/fun/play.js
Normal file
|
@ -0,0 +1,203 @@
|
|||
const ytdl = require('ytdl-core');
|
||||
const ytSearch = require('yt-search');
|
||||
const Discord = require('discord.js')
|
||||
const conf = require('../../../conf/conf.json')
|
||||
|
||||
const queue = new Map();
|
||||
|
||||
module.exports = {
|
||||
name: 'play',
|
||||
description: "the moosk command",
|
||||
aliases: ["p", "q", "skip", "stop", "remove", "queue"],
|
||||
async execute(message, args, Discord, currentServer, messageUser, client) {
|
||||
|
||||
/*TODO
|
||||
*make these embeds better and objects
|
||||
*/
|
||||
const noContentErrorEmbed = new Discord.MessageEmbed()
|
||||
.setAuthor('Music', `${conf.bot.logo}`)
|
||||
.setTitle('Error')
|
||||
.setURL(conf.domain)
|
||||
.setColor(conf.colour.okError)
|
||||
.setDescription("well what do you want to listen to?\ni know i am an amazing bot but i cant read minds ~~yet~~")
|
||||
.addField("possible fixes:", `You have two spaces between ${currentServer.prefix}play and the url/song name remove one of them`)
|
||||
.setTimestamp()
|
||||
.setFooter(`Requested by ${message.member.displayName}`, `${message.author.displayAvatarURL()}`);
|
||||
|
||||
const notVoiceErrorEmbed = new Discord.MessageEmbed()
|
||||
.setAuthor('Music', `${conf.bot.logo}`)
|
||||
.setTitle('Error')
|
||||
.setURL(conf.domain)
|
||||
.setColor(conf.colour.okError)
|
||||
.setTitle("you need to be in a voice channel to execute this command im not exactly going to send you the cd")
|
||||
.setTimestamp()
|
||||
.setFooter(`Requested by ${message.member.displayName}`, `${message.author.displayAvatarURL()}`);
|
||||
|
||||
const noSongsErrorEmbed = new Discord.MessageEmbed()
|
||||
.setAuthor('Music', `${conf.bot.logo}`)
|
||||
.setTitle('Error')
|
||||
.setURL(conf.domain)
|
||||
.setColor(conf.colour.okError)
|
||||
.setTitle("oof there are no songs left in queue")
|
||||
.setTimestamp()
|
||||
.setFooter(`Requested by ${message.member.displayName}`, `${message.author.displayAvatarURL()}`);
|
||||
|
||||
const errorEmbed = new Discord.MessageEmbed()
|
||||
.setAuthor('Music', `${conf.bot.logo}`)
|
||||
.setTitle('Error')
|
||||
.setURL(conf.domain)
|
||||
.setColor(conf.colour.okError)
|
||||
.setTitle("There was some error ~~like there always is~~")
|
||||
.setTimestamp()
|
||||
.setFooter(`Requested by ${message.member.displayName}`, `${message.author.displayAvatarURL()}`);
|
||||
|
||||
const videoErrorEmbed = new Discord.MessageEmbed()
|
||||
.setAuthor('Music', `${conf.bot.logo}`)
|
||||
.setTitle('Error')
|
||||
.setURL(conf.domain)
|
||||
.setColor(conf.colour.okError)
|
||||
.setTitle("I cant seem to find that video")
|
||||
.setDescription("try adding more key words or just use the song's url")
|
||||
.setTimestamp()
|
||||
.setFooter(`Requested by ${message.member.displayName}`, `${message.author.displayAvatarURL()}`);
|
||||
|
||||
|
||||
const voiceChannel = message.member.voice.channel;
|
||||
if (!voiceChannel) return message.channel.send(notVoiceErrorEmbed);
|
||||
const permissions = voiceChannel.permissionsFor(message.client.user);
|
||||
if (!permissions.has('connect')) return message.channel.send('i cant connect to this voice channel ask someone that can help me');
|
||||
if (!permissions.has('speak')) return message.channel.send('i cant talk in this voice channel aks someone that can help me');
|
||||
const serverQueue = queue.get(message.guild.id);
|
||||
|
||||
|
||||
if (args[0] === 'play' || args[0] === 'p') {
|
||||
if (!args[1]) return message.channel.send(noContentErrorEmbed).catch(e => console.log(e))
|
||||
let song = {};
|
||||
const videoFinder = async(query) => {
|
||||
const videoResult = await ytSearch(query).catch(e => console.log(e));
|
||||
try {
|
||||
return (videoResult.videos.length > 1) ? videoResult.videos[0] : null;
|
||||
} catch (err) {
|
||||
console.log(err)
|
||||
}
|
||||
}
|
||||
|
||||
let songQuery = args.slice(1).join(' ').replace('http://', '').replace('https://', '').replace('www.', '').replace('youtube.com/', '').replace('/watch?v=', '').replace('&feature=share', '').replace('youtu.be', '')
|
||||
|
||||
const video = await videoFinder(songQuery);
|
||||
|
||||
if (video) {
|
||||
song = { title: video.title, url: video.url }
|
||||
} else {
|
||||
message.channel.send(videoErrorEmbed).catch(e => console.log(e))
|
||||
}
|
||||
if (!serverQueue) {
|
||||
const queueConstructor = {
|
||||
voiceChannel: voiceChannel,
|
||||
textChannel: message.channel,
|
||||
connection: null,
|
||||
songs: []
|
||||
}
|
||||
queue.set(message.guild.id, queueConstructor);
|
||||
queueConstructor.songs.push(song);
|
||||
try {
|
||||
const connection = await voiceChannel.join();
|
||||
queueConstructor.connection = connection;
|
||||
videoPlayer(message.guild, queueConstructor.songs[0], message);
|
||||
} catch (error) {
|
||||
queue.delete(message.guild.id);
|
||||
message.channel.send(errorEmbed).catch(e => console.log(e))
|
||||
console.log('error: ' + error)
|
||||
}
|
||||
} else {
|
||||
serverQueue.songs.push(song);
|
||||
let addSongEmbed = new Discord.MessageEmbed()
|
||||
.setAuthor('Music', `${conf.bot.logo}`)
|
||||
.setColor(conf.colour.ok)
|
||||
.setTitle(`**${song.title}** added to the queue`)
|
||||
.setURL(`${song.url}`)
|
||||
.setTimestamp()
|
||||
.setFooter(`Requested by ${message.member.displayName}`, `${message.author.displayAvatarURL()}`);
|
||||
return message.channel.send(addSongEmbed).catch(e => console.log(e))
|
||||
}
|
||||
} else if (args[0] === 'queue' || args[0] === 'q') serverQueueGet(message, serverQueue, args);
|
||||
else if (args[0] === 'skip') skipSong(message, serverQueue);
|
||||
else if (args[0] === 'stop') stopSong(message, serverQueue);
|
||||
else if (args[0] === 'remove') removeSong(message, serverQueue, args);
|
||||
}
|
||||
}
|
||||
const videoPlayer = async(guild, song, message) => {
|
||||
const songQueue = queue.get(guild.id);
|
||||
if (!song) {
|
||||
songQueue.voiceChannel.leave();
|
||||
queue.delete(guild.id);
|
||||
return;
|
||||
}
|
||||
const stream = ytdl(song.url, { filter: 'audioonly' });
|
||||
try {
|
||||
songQueue.connection.play(stream, { seek: 0, volume: 0.5 })
|
||||
.on('finish', () => {
|
||||
songQueue.songs.shift();
|
||||
videoPlayer(guild, songQueue.songs[0], message);
|
||||
})
|
||||
} catch (err) {
|
||||
message.channel.send("i cant connect to the voice channel within the time frame i have high ping or some other error")
|
||||
}
|
||||
if (song.url) {
|
||||
let embedUrl = song.url
|
||||
if (!embedUrl.includes('http')) {
|
||||
embedUrl = conf.domain
|
||||
}
|
||||
let addSongEmbed = new Discord.MessageEmbed()
|
||||
.setAuthor('Music', `${conf.bot.logo}`)
|
||||
.setColor(conf.colour.ok)
|
||||
.setTitle(`Now playing **${song.title}**`)
|
||||
.setURL(`${embedUrl}`)
|
||||
.setTimestamp()
|
||||
.setFooter(`Requested by ${message.member.displayName}`, `${message.author.displayAvatarURL()}`);
|
||||
await songQueue.textChannel.send(addSongEmbed)
|
||||
}
|
||||
}
|
||||
|
||||
const serverQueueGet = async(message, serverQueue, args) => {
|
||||
if (!message.member.voice.channel) return message.channel.send(notVoiceErrorEmbed);
|
||||
let serverQueueEmbed = new Discord.MessageEmbed()
|
||||
.setAuthor('Music Queue', `${conf.bot.logo}`)
|
||||
.setColor(conf.colour.ok)
|
||||
.setTitle(`the server queue`)
|
||||
.setURL(`${conf.domain}`)
|
||||
.setTimestamp()
|
||||
.setFooter(`Requested by ${message.member.displayName}`, `${message.author.displayAvatarURL()}`)
|
||||
await serverQueue.songs.forEach(theSong => {
|
||||
serverQueueEmbed.addField(`${serverQueue.songs.indexOf(theSong)}`, `__title:__ ${theSong.title}\n__url:__ ${theSong.url}`)
|
||||
})
|
||||
await message.channel.send(serverQueueEmbed)
|
||||
|
||||
}
|
||||
const skipSong = (message, serverQueue) => {
|
||||
if (!message.member.voice.channel) return message.channel.send(notVoiceErrorEmbed);
|
||||
if (!serverQueue) {
|
||||
return message.channel.send(noSongsErrorEmbed);
|
||||
}
|
||||
serverQueue.connection.dispatcher.end();
|
||||
}
|
||||
|
||||
const stopSong = (message, serverQueue) => {
|
||||
if (!message.member.voice.channel) return message.channel.send(notVoiceErrorEmbed);
|
||||
serverQueue.songs = [];
|
||||
serverQueue.connection.dispatcher.end();
|
||||
}
|
||||
|
||||
const removeSong = (message, serverQueue) => {
|
||||
serverQueue.songs.forEach(theSong => {
|
||||
if (args[1] == serverQueue.songs.indexOf(theSong)) {
|
||||
try {
|
||||
serverQueue.songs.indexOf(theSong) > -1 ? serverQueue.songs.splice(serverQueue.songs.indexOf(theSong), 1) : false
|
||||
} catch (err) {
|
||||
message.channel.send("there was an error removing that song")
|
||||
}
|
||||
} else {
|
||||
message.channel.send("That song isn't in the queue you can use the url insted.\nYou can find the url by clicking on the blue text in the embed i sent when you requested to play that song.")
|
||||
}
|
||||
})
|
||||
}
|
38
src/bot/commands/info/about.js
Normal file
38
src/bot/commands/info/about.js
Normal file
|
@ -0,0 +1,38 @@
|
|||
const { version } = require('../../../../package.json');
|
||||
const conf = require('../../../conf/conf.json')
|
||||
|
||||
module.exports = {
|
||||
name: 'about',
|
||||
description: "about bot",
|
||||
async execute(message, args, Discord, currentServer, messageUser, client) {
|
||||
message.channel.send(conf.domain + '/img/loading.gif').then(m => {
|
||||
|
||||
let totalSeconds = (client.uptime / 1000);
|
||||
let days = Math.floor(totalSeconds / 86400);
|
||||
totalSeconds %= 86400;
|
||||
let hours = Math.floor(totalSeconds / 3600);
|
||||
totalSeconds %= 3600;
|
||||
let minutes = Math.floor(totalSeconds / 60);
|
||||
let seconds = Math.floor(totalSeconds % 60);
|
||||
|
||||
let aboutEmbed = new Discord.MessageEmbed()
|
||||
.setAuthor(conf.bot.name, `${conf.bot.logo}`, `${conf.domain}`)
|
||||
.setDescription('everything you need to know.')
|
||||
.setColor(conf.colour.ok)
|
||||
.setTitle('about')
|
||||
.setThumbnail(`${message.guild.iconURL() || `${conf.domain}/logo.png`}`)
|
||||
.addField('Website:', `${conf.domain}`)
|
||||
.addField('Coolness level', `epic bot for ${message.guild.name} server`)
|
||||
.addField('Developer(s)', '<@!522534458071449620>')
|
||||
.addField('Version', `${version}`)
|
||||
.addField('Libary', `discord.js v12`)
|
||||
.addField("commands sent:", `${currentServer.commandCount} commands`)
|
||||
.addField('Bot version:', `${version}`)
|
||||
.addField('Up Time', `${days} d, ${hours} h, ${minutes} m, ${seconds} s`)
|
||||
.addField("Memory usage:", `${(process.memoryUsage().heapUsed / 1024 / 1024).toFixed(2)} MB / 1GB`)
|
||||
.addField('Ping', `ping: ${m.createdTimestamp - message.createdTimestamp} api ping: ${Math.round(client.ws.ping)}`)
|
||||
.setFooter(`Requested by ${message.member.displayName}`, `${message.author.displayAvatarURL()}`);
|
||||
m.edit(aboutEmbed).catch(error => console.log('error: ' + error));
|
||||
}).catch(error => console.log('error: ' + error))
|
||||
}
|
||||
}
|
49
src/bot/commands/info/help.js
Normal file
49
src/bot/commands/info/help.js
Normal file
|
@ -0,0 +1,49 @@
|
|||
const conf = require('../../../conf/conf.json')
|
||||
module.exports = {
|
||||
name: 'help',
|
||||
description: "help command",
|
||||
execute(message, args, Discord, currentServer, messageUser, client) {
|
||||
|
||||
|
||||
if (args[1] == 'embed') {
|
||||
let helpSomethingEmbed = new Discord.MessageEmbed()
|
||||
.setAuthor(conf.bot.name, conf.bot.logo)
|
||||
.setColor('#10FF00')
|
||||
.setTitle('Help embed')
|
||||
.setDescription('**For mods and admins only**\nLet’s mods and admin make a custom embed.')
|
||||
.addField('Command structure', `${currentServer.prefix}embed [title] [description] [colour]`)
|
||||
.addField('Command example', `${currentServer.prefix}embed [bruv is awesome] [just joking you are] [#FF0000]`)
|
||||
.addField('Extra info', `To get the # colour code(s) [click here](https://htmlcolorcodes.com/)`)
|
||||
.setThumbnail(`${message.guild.iconURL() || `${conf.domain}/logo.png`}`)
|
||||
.setTimestamp()
|
||||
.setFooter(`Requested by ${message.member.displayName}`, `${message.author.displayAvatarURL()}`);
|
||||
message.channel.send(helpSomethingEmbed).catch(error => console.log('error: ' + error));
|
||||
} else if (args[1] == 'embed-img') {
|
||||
let helpSomethingEmbed = new Discord.MessageEmbed()
|
||||
.setAuthor(conf.bot.name, conf.bot.logo)
|
||||
.setColor('#10FF00')
|
||||
.setTitle('Help embed-img')
|
||||
.setDescription('**For mods and admins only**\nLet’s mods and admin make a custom embed.')
|
||||
.addField('Command structure', `${currentServer.prefix}}embed [title] [description] [colour] [img-url]`)
|
||||
.addField('Command example', `${currentServer.prefix}embed [bruv is awesome] [just joking you are] [#FF0000] [http://imgsite.com/knightrider.png]`)
|
||||
.addField('Extra info', `To get the # colour code(s) [click here](https://htmlcolorcodes.com/)`)
|
||||
.setThumbnail(`${message.guild.iconURL() || `${conf.domain}/logo.png`}`)
|
||||
.setTimestamp()
|
||||
.setFooter(`Requested by ${message.member.displayName}`, `${message.author.displayAvatarURL()}`);
|
||||
message.channel.send(helpSomethingEmbed).catch(error => console.log('error: ' + error));
|
||||
} else {
|
||||
let helpEmbed = new Discord.MessageEmbed()
|
||||
.setColor(conf.colour.ok)
|
||||
.setTitle('Help!')
|
||||
.setURL(`${conf.domain}`)
|
||||
.setAuthor(conf.bot.name, conf.bot.logo)
|
||||
.addField("util commands:", `${currentServer.prefix}ping - shows ping\n${currentServer.prefix}about - gives general information about the bot`)
|
||||
.addField("general commands:", `${currentServer.prefix}mcstatus - shows minecraft server status\n${currentServer.prefix}memes - shows a random meme from redid mus be done in memes channel\n${currentServer.prefix}fivem - shows fiveM server status\n${currentServer.prefix}fivem players - shows online players on fiveM\n${currentServer.prefix}fivem ip - gives you the fiveM server ip\n${currentServer.prefix}play (song name) or (youtube-url) - plays selected music in a voice channel\n${currentServer.prefix}skip - skips the current song to the next one on the queue\n${currentServer.prefix}stop - bot stops playing music\n`)
|
||||
.addField("moderator commands:", `${currentServer.prefix}say #channel message - bot sends message in channel of choice\n${currentServer.prefix}filter <safe/normal/off> - sets the word filter level\n${currentServer.prefix}userinfo <@user> - gives how many strikes a user has and other basic info on the user like nots and join dates.\n${currentServer.prefix}noteset <@user> - sets a note for a user\n${currentServer.prefix}note <@user> - see a moderator note for a user\n${currentServer.prefix}embed [title] [description] [colour] - sends a embed\n${currentServer.prefix}embed-img [title] [description] [colour] [img-url]\n${currentServer.prefix}OTR11 - for <@!276156203770314755> announcment`)
|
||||
.setThumbnail(`${message.guild.iconURL() || `${conf.domain}/logo.png`}`)
|
||||
.setTimestamp()
|
||||
.setFooter(`Requested by ${message.member.displayName}`, `${message.author.displayAvatarURL()}`);
|
||||
message.channel.send(helpEmbed).catch(error => console.log('error: ' + error))
|
||||
}
|
||||
}
|
||||
}
|
11
src/bot/commands/info/ping.js
Normal file
11
src/bot/commands/info/ping.js
Normal file
|
@ -0,0 +1,11 @@
|
|||
module.exports = {
|
||||
name: 'ping',
|
||||
description: "about bot",
|
||||
execute(message, args, Discord, currentServer, messageUser, client) {
|
||||
message.channel.send("Pinging...").then(m => {
|
||||
var ping = m.createdTimestamp - message.createdTimestamp;
|
||||
var apiPing = Math.round(client.ws.ping)
|
||||
m.edit(`ping: ${ping}\napi ping: ${apiPing}`).catch(error => console.log('error: ' + error))
|
||||
});
|
||||
}
|
||||
}
|
0
src/bot/commands/moderation/addstaff.js
Normal file
0
src/bot/commands/moderation/addstaff.js
Normal file
45
src/bot/commands/moderation/editfilter.js
Normal file
45
src/bot/commands/moderation/editfilter.js
Normal file
|
@ -0,0 +1,45 @@
|
|||
const fs = require('fs')
|
||||
const conf = require('../../../conf/conf.json')
|
||||
module.exports = {
|
||||
name: 'editfilter',
|
||||
description: "edit the filter array",
|
||||
execute(message, args, Discord, currentServer, messageUser, client) {
|
||||
if (currentServer.staff.includes(message.author.id) || message.member.roles.cache.find(r => server.staffRoles.includes(r.name))) {
|
||||
|
||||
if (!args[1]) {
|
||||
message.channel.send("please specify an operation <add/remove/dash>");
|
||||
return;
|
||||
};
|
||||
if (!args[2]) {
|
||||
message.channel.send("please specify something to add to the filter");
|
||||
return;
|
||||
};
|
||||
if (message.content.toLowerCase().substring(currentServer.prefix.length).split(" ").slice(2).join(" ").includes('@everyone') || message.content.toLowerCase().substring(currentServer.prefix.length).split(" ").slice(2).join(" ").includes('@here')) {
|
||||
message.channel.send("please dont try and exploit me, if you would like to add that to the filter for a genuing reason please use the admin dashboard");
|
||||
return;
|
||||
};
|
||||
|
||||
if (args[1] == 'add') {
|
||||
currentServer.filter[currentServer.filter.level].push(message.content.toLowerCase().substring(currentServer.prefix.length).split(" ").slice(2).join(" "));
|
||||
currentServer.save();
|
||||
message.channel.send(message.content.toLowerCase().substring(currentServer.prefix.length).split(" ").slice(2).join(" ") + " has been added to the `" + currentServer.filter.level + "` filter");
|
||||
|
||||
} else if (args[1] == 'remove') {
|
||||
const index = currentServer.filter[currentServer.filter.level].indexOf(message.content.toLowerCase().substring(currentServer.prefix.length).split(" ").slice(2).join(" "));
|
||||
if (index > -1) {
|
||||
currentServer.filter[currentServer.filter.level].splice(index, 1);
|
||||
message.channel.send("`" + message.content.toLowerCase().substring(currentServer.prefix.length).split(" ").slice(2).join(" ") + "` has been removed from the `" + currentServer.filter.level + "` filter");
|
||||
} else {
|
||||
message.channel.send("you cant remove that as it dosnt exist in the `" + currentServer.filter.level + "` filter");
|
||||
};
|
||||
|
||||
} else if (args[1] == 'dash' || args[1] == 'dashboard') {
|
||||
message.channel.send(conf.domain + "/dashboard");
|
||||
};
|
||||
|
||||
|
||||
} else {
|
||||
return message.reply("you cant do that only staff can").catch(e => console.log(e));
|
||||
};
|
||||
}
|
||||
}
|
32
src/bot/commands/moderation/embed-img.js
Normal file
32
src/bot/commands/moderation/embed-img.js
Normal file
|
@ -0,0 +1,32 @@
|
|||
module.exports = {
|
||||
name: 'embed-img',
|
||||
description: "embed with image command for mods and admins",
|
||||
execute(message, args, Discord, currentServer, messageUser, client) {
|
||||
if (currentServer.staff.includes(message.author.id) || message.member.roles.cache.find(r => server.staffRoles.includes(r.name))) {
|
||||
if (!args[1]) return message.reply(`you at leas need to supply a title if you stuck do ${currentServer.prefix}help embed`);
|
||||
if (!message.content.includes('[')) return message.reply(`something is wrong with that if youre stuck do ${currentServer.prefix}help embed`);
|
||||
|
||||
let mcontent = message.content;
|
||||
let titleStart = mcontent.indexOf('[');
|
||||
let titleEnd = mcontent.indexOf(']');
|
||||
let title = mcontent.substr(titleStart + 1, titleEnd - titleStart - 1);
|
||||
|
||||
let descStart = mcontent.indexOf('[', titleStart + 1);
|
||||
let descEnd = mcontent.indexOf(']', titleEnd + 1);
|
||||
let description = mcontent.substr(descStart + 1, descEnd - descStart - 1);
|
||||
|
||||
let colorstart = mcontent.indexOf('[', descStart + 1);
|
||||
let colorend = mcontent.indexOf(']', descEnd + 1);
|
||||
let color = mcontent.substr(colorstart + 1, colorend - colorstart - 1);
|
||||
|
||||
let imgstart = mcontent.indexOf('[', colorstart + 1);
|
||||
let imgend = mcontent.indexOf(']', colorend + 1);
|
||||
let img = mcontent.substr(imgstart + 1, imgend - imgstart - 1);
|
||||
|
||||
let custome_embed = new Discord.MessageEmbed().setAuthor(`${message.member.displayName}`, `${message.author.displayAvatarURL()}`).setTitle(title).setDescription(description).setColor(color).setImage(`${img}`);
|
||||
message.channel.send(custome_embed);
|
||||
} else {
|
||||
return message.reply("you cant do that only staff can").catch(e => console.log(e));
|
||||
};
|
||||
}
|
||||
}
|
30
src/bot/commands/moderation/embed.js
Normal file
30
src/bot/commands/moderation/embed.js
Normal file
|
@ -0,0 +1,30 @@
|
|||
module.exports = {
|
||||
name: 'embed',
|
||||
description: "embed command for mods and admins",
|
||||
execute(message, args, Discord, currentServer, messageUser, client) {
|
||||
if (currentServer.staff.includes(message.author.id) || message.member.roles.cache.find(r => server.staffRoles.includes(r.name))) {
|
||||
if (!args[1]) return message.reply(`you at leas need to supply a title if you stuck do ${currentServer.prefix}help embed`);
|
||||
if (!message.content.includes('[')) return message.reply(`something is wrong with that if youre stuck do ${currentServer.prefix}help embed`);
|
||||
|
||||
|
||||
let mcontent = message.content;
|
||||
let titleStart = mcontent.indexOf('[');
|
||||
let titleEnd = mcontent.indexOf(']');
|
||||
let title = mcontent.substr(titleStart + 1, titleEnd - titleStart - 1);
|
||||
|
||||
let descStart = mcontent.indexOf('[', titleStart + 1);
|
||||
let descEnd = mcontent.indexOf(']', titleEnd + 1);
|
||||
let description = mcontent.substr(descStart + 1, descEnd - descStart - 1);
|
||||
|
||||
let colorstart = mcontent.indexOf('[', descStart + 1);
|
||||
let colorend = mcontent.indexOf(']', descEnd + 1);
|
||||
let color = mcontent.substr(colorstart + 1, colorend - colorstart - 1);
|
||||
|
||||
let custome_embed = new Discord.MessageEmbed().setAuthor(`${message.member.displayName}`, `${message.author.displayAvatarURL()}`).setTitle(title).setDescription(description).setColor(color);
|
||||
message.channel.send(custome_embed);
|
||||
|
||||
} else {
|
||||
return message.reply("you cant do that only staff can").catch(e => console.log(e));
|
||||
};
|
||||
}
|
||||
}
|
26
src/bot/commands/moderation/filter.js
Normal file
26
src/bot/commands/moderation/filter.js
Normal file
|
@ -0,0 +1,26 @@
|
|||
module.exports = {
|
||||
name: 'filter',
|
||||
description: "sets filter",
|
||||
async execute(message, args, Discord, currentServer, messageUser, client) {
|
||||
if (currentServer.staff.includes(message.author.id) || message.member.roles.cache.find(r => server.staffRoles.includes(r.name))) {
|
||||
if (args[1] == 'off') {
|
||||
currentServer.filter.level = 'off';
|
||||
currentServer.save();
|
||||
message.channel.send("filter has been set to " + currentServer.filter.level);
|
||||
} else if (args[1] == 'normal') {
|
||||
currentServer.filter.level = 'normal';
|
||||
currentServer.save();
|
||||
message.channel.send("filter has been set to " + currentServer.filter.level);
|
||||
} else if (args[1] == 'safe') {
|
||||
currentServer.filter.level = 'safe';
|
||||
currentServer.save();
|
||||
message.channel.send("filter has been set to " + currentServer.filter.level);
|
||||
} else {
|
||||
message.channel.send("that is not a valid filter setting you can chose from: 'normal' 'safe' and 'off'.");
|
||||
};
|
||||
|
||||
} else {
|
||||
return message.reply("you cant do that only staff can").catch(e => console.log(e));
|
||||
};
|
||||
}
|
||||
}
|
28
src/bot/commands/moderation/gameroles.js
Normal file
28
src/bot/commands/moderation/gameroles.js
Normal file
|
@ -0,0 +1,28 @@
|
|||
const conf = require('../../../conf/conf.json');
|
||||
module.exports = {
|
||||
name: 'rulesrolesljoughuihoutfd8es5tryj/i.uliutygrjyhgjlkukbjhcfjklhgfhjouhbgrvycghujyiljknhbgvfhtgfhiuoihkjbnhbvgfgyuo',
|
||||
description: "say command for mods and admins",
|
||||
async execute(message, args, Discord, currentServer, messageUser, client) {
|
||||
if (currentServer.staff.includes(message.author.id) || message.member.roles.cache.find(r => server.staffRoles.includes(r.name))) {
|
||||
|
||||
const exampleEmbed = new Discord.MessageEmbed()
|
||||
.setColor(conf.colour.ok)
|
||||
.setAuthor("Game Reaction Roles")
|
||||
.setTitle("react to get your roles")
|
||||
.setThumbnail('https://cdn.discordapp.com/icons/584484766997282836/94b16e813edb9a2f1df4a5bd16f98ad1.png')
|
||||
.setURL("http://knightRider.rf.gd/reaction-role-error.php")
|
||||
.setDescription("🚚 - <@&595087305212035084>\n🚜 - <@&595086913430355973>\n⛏️ - <@&595087098604683277>\n🗺️ - <@&604424840807710721>\n🚓 - <@&691635977889906849>\n🚗 - <@&752217267600621578>\n🏎️ - <@&752217137728192543>\n🔧 - <@&595767995998011392>\n⚙️ - <@&860942666195927050>")
|
||||
.setFooter('something wrong? go to http://knightRider.rf.gd/er.html');
|
||||
let msg = await message.channel.send(exampleEmbed);
|
||||
msg.react("🚚")
|
||||
msg.react("🚜")
|
||||
msg.react("⛏")
|
||||
msg.react("🗺")
|
||||
msg.react("🚓")
|
||||
msg.react("🚗")
|
||||
msg.react("🏎")
|
||||
msg.react("🔧")
|
||||
msg.react("⚙")
|
||||
}
|
||||
}
|
||||
}
|
0
src/bot/commands/moderation/mute.js
Normal file
0
src/bot/commands/moderation/mute.js
Normal file
7
src/bot/commands/moderation/note.js
Normal file
7
src/bot/commands/moderation/note.js
Normal file
|
@ -0,0 +1,7 @@
|
|||
module.exports = {
|
||||
name: 'note',
|
||||
description: "shows a users note",
|
||||
async execute(message, args, Discord, currentServer, messageUser, client) {
|
||||
message.reply("* depricated *: do " + currentServer.prefix + "userinfo @someone")
|
||||
}
|
||||
}
|
16
src/bot/commands/moderation/say.js
Normal file
16
src/bot/commands/moderation/say.js
Normal file
|
@ -0,0 +1,16 @@
|
|||
module.exports = {
|
||||
name: 'say',
|
||||
description: "say command for mods and admins",
|
||||
execute(message, args, Discord, currentServer, messageUser, client) {
|
||||
if (currentServer.staff.includes(message.author.id) || message.member.roles.cache.find(r => server.staffRoles.includes(r.name))) {
|
||||
|
||||
message.delete();
|
||||
let sayArgs = message.content.substring(prefix.length).split(" ");
|
||||
if (message.content.toLowerCase().includes('@everyone')) return message.reply(`Holup you can't @ every one`);
|
||||
if (message.content.toLowerCase().includes('@here')) return message.reply(`Holup you can't @ here`);
|
||||
message.channel.send(`${sayArgs.slice(2).join(" ")}`);
|
||||
} else {
|
||||
return message.reply("you cant do that only staff can").catch(e => console.log(e));
|
||||
};
|
||||
}
|
||||
}
|
0
src/bot/commands/moderation/setnote.js
Normal file
0
src/bot/commands/moderation/setnote.js
Normal file
45
src/bot/commands/moderation/townhall.js
Normal file
45
src/bot/commands/moderation/townhall.js
Normal file
|
@ -0,0 +1,45 @@
|
|||
const conf = require('../../../conf/conf.json')
|
||||
module.exports = {
|
||||
name: 'townhall',
|
||||
description: "say command for mods and admins",
|
||||
async execute(message, args, Discord, currentServer, messageUser, client) {
|
||||
if (currentServer.staff.includes(message.author.id) || message.member.roles.cache.find(r => server.staffRoles.includes(r.name))) {
|
||||
|
||||
if (args[1] == 'end') {
|
||||
if (args[2] == 'confirm') {
|
||||
require('../../events/voicestateupdate').members[message.guild.id] = [];
|
||||
message.channel.send("townHall meeting members have been removed.")
|
||||
} else {
|
||||
message.channel.send("are you sure you want to end the townhall meeting? this will remove all members even ones that may still be currently in the voice channel.\nto confirm please do `" + currentServer.prefix + "townhall end confirm`.")
|
||||
}
|
||||
} else {
|
||||
let members = require('../../events/voicestateupdate').members[message.guild.id];
|
||||
let mpos = 0;
|
||||
let mEmbed = new Discord.MessageEmbed()
|
||||
.setColor(conf.colour.ok)
|
||||
.setTitle('Members that have Joined Townhall Vc')
|
||||
.setURL(conf.domain + '/server/' + message.guild.id + '/townhall')
|
||||
.setAuthor(conf.bot.name, conf.bot.logo, conf.bot.url)
|
||||
.setDescription('when the townhall meeting ends remember to do `' + currentServer.prefix + 'townhall end` otherwise users from the previous meeting will show up.')
|
||||
.setThumbnail(message.guild.iconURL() || conf.domain + '/logo.png')
|
||||
.setTimestamp()
|
||||
.setFooter('TownHall Meeting');
|
||||
|
||||
await members.forEach(async(member) => {
|
||||
let isStaff;
|
||||
if (client.guilds.cache.get(currentServer.id).members.cache.get(member).roles.cache.find(r => currentServer.staffRoles.includes(r.name))) {
|
||||
isStaff = 'yes';
|
||||
} else {
|
||||
isStaff = 'no';
|
||||
};
|
||||
mpos++;
|
||||
await mEmbed.addField(`__${client.users.cache.get(member).tag}:__`, `__**id:**__ ${member}\n__**@:**__ <@!${member}>\n__**isStaff:**__ ${isStaff}\n__**Join Position:**__ ${mpos}`);
|
||||
})
|
||||
message.channel.send({ embed: mEmbed });
|
||||
};
|
||||
} else {
|
||||
return message.reply("you cant do that only staff can").catch(e => console.log(e));
|
||||
};
|
||||
|
||||
}
|
||||
}
|
48
src/bot/commands/moderation/userinfo.js
Normal file
48
src/bot/commands/moderation/userinfo.js
Normal file
|
@ -0,0 +1,48 @@
|
|||
const conf = require('../../../conf/conf.json');
|
||||
const User = require('../../../models/user');
|
||||
module.exports = {
|
||||
name: 'userinfo',
|
||||
description: "get information about someone on the server",
|
||||
async execute(message, args, Discord, currentServer, messageUser, client) {
|
||||
try {
|
||||
if (currentServer.staff.includes(message.author.id) || message.member.roles.cache.find(r => server.staffRoles.includes(r.name))) {
|
||||
let theUser;
|
||||
if (message.mentions.users.first()) {
|
||||
theUser = message.mentions.users.first();
|
||||
} else {
|
||||
theUser = message.author;
|
||||
};
|
||||
let currentUser = await User.findOne({ userid: theUser, guildid: message.guild.id });
|
||||
if (currentUser == null) return message.channel.send("that user inst in the database");
|
||||
|
||||
const userInfoEmbed = new Discord.MessageEmbed()
|
||||
.setAuthor(`${conf.bot.name}`, `${conf.bot.logo}`)
|
||||
.setTitle('user info')
|
||||
.setURL(conf.domain)
|
||||
.setColor(conf.colour.ok)
|
||||
.setThumbnail(theUser.avatarURL())
|
||||
.addField("__**user:**__", "<@!" + currentUser.id + "> (" + currentUser.id + ")")
|
||||
.addField("__**strikes:**__", "`" + currentUser.strike.toString() + "`")
|
||||
.addField("__**note:**__", "`" + currentUser.note + "`")
|
||||
.setTimestamp()
|
||||
.setFooter(`Requested by ${message.member.displayName} | react with a ❌ to delete`, `${message.author.displayAvatarURL()}`);
|
||||
message.channel.send(userInfoEmbed).then(async sentMsg => {
|
||||
await sentMsg.react('❌');
|
||||
sentMsg.awaitReactions(async(reaction, user) => {
|
||||
if (reaction.emoji.name === '❌') await sentMsg.delete();
|
||||
});
|
||||
/*
|
||||
await sentMsg.react('❌');
|
||||
const filter = (reaction, user) => ['❌'].includes(reaction.emoji.name) && user.id === message.author.id;
|
||||
const [reaction] = await sentMsg.awaitReactions(filter, { maxMatches: 1 });
|
||||
if (reaction.emoji.name === '❌') await sentMsg.delete();
|
||||
*/
|
||||
});
|
||||
} else {
|
||||
return message.reply("you cant do that only staff can").catch(e => console.log(e));
|
||||
};
|
||||
} catch (err) {
|
||||
message.channel.send("an error happened. are they in the \"database\"?")
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue