summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authors1n <[email protected]>2020-04-01 21:10:15 -0700
committerGitHub <[email protected]>2020-04-01 21:10:15 -0700
commit7961797bb7c62b54622ef8c3d41dde87aa4994d8 (patch)
treebba1d659a51182ab5006c31ac7f4fffb2ebdffa4
downloads5nical-7961797bb7c62b54622ef8c3d41dde87aa4994d8.tar.xz
s5nical-7961797bb7c62b54622ef8c3d41dde87aa4994d8.zip
main
-rw-r--r--app.js152
-rw-r--r--config.json11
-rw-r--r--package.json15
3 files changed, 178 insertions, 0 deletions
diff --git a/app.js b/app.js
new file mode 100644
index 0000000..a8ac836
--- /dev/null
+++ b/app.js
@@ -0,0 +1,152 @@
+const Discord = require('discord.js');
+const config = require('./config.json');
+const bot = new Discord.Client();
+const isImageUrl = require('is-image-url');
+
+bot.on('ready', () => {
+ console.log(`Started bot: ${bot.user.tag} (ID: ${bot.user.id})\nCurrently running on ${bot.guilds.size} server(s).`);
+ bot.user.setActivity('psycho~ owo.', {
+ type: 'LISTENING'
+ });
+
+ // Outputs available commands in output console
+ commands = ['ping', '8ball/ball', 'say', 'server'];
+ console.log(commands);
+});
+
+// Outputs errors in console window
+bot.on('error', console.error);
+
+// Start Bot Commands
+bot.on('message', msg => {
+ console.log(msg.content.toLowerCase());
+ if (msg.channel.name === 'bots' || msg.channel.name === 'mods-chat' || msg.member.hasPermission('KICK_MEMBERS')) {
+
+ var msgContent = msg.content.toLowerCase();
+ console.log(msgContent);
+ console.log(config.prefixes.main);
+
+ function prefixCheck() {
+ if (msgContent.startsWith(config.prefixes.main)) {
+ return "main";
+ } else if (msgContent.startsWith(config.prefixes.alt)) {
+ return "alt1";
+ } else if (msgContent.startsWith(config.prefixes.alt2)) {
+ return "alt2";
+ } else if (msgContent.startsWith(config.prefixes.alt3)) {
+ return "alt3";
+ } else if (msgContent.startsWith(config.prefixes.alt4)) {
+ return "alt4";
+ } else if (msgContent.startsWith(config.prefixes.alt4b)) {
+ return "alt4b";
+ }
+ }
+
+ if (prefixCheck() == "main") {
+ var args = msg.content.slice(config.prefixes.main.length).split(/ +/);
+ var command = args.shift().toLowerCase();
+
+ if (msg.author.bot || !msg.content.startsWith(config.prefixes.main)) return;
+ } else if (prefixCheck() == "alt1") {
+ var args = msg.content.slice(config.prefixes.alt.length).split(/ +/);
+ var command = args.shift().toLowerCase();
+
+ if (msg.author.bot || !msg.content.startsWith(config.prefixes.alt)) return;
+ } else if (prefixCheck() == "alt2") {
+ var args = msg.content.slice(config.prefixes.alt2.length).split(/ +/);
+ var command = args.shift().toLocaleLowerCase();
+
+ if (msg.author.bot || !msg.content.startsWith(config.prefixes.alt2)) return;
+ } else if (prefixCheck() == "alt3") {
+ var args = msg.content.slice(config.prefixes.alt3.length).split(/ +/);
+ var command = args.shift().toLocaleLowerCase();
+
+ if (msg.author.bot || !msg.content.startsWith(config.prefixes.alt3)) return;
+ } else if (prefixCheck() == "alt4") {
+ var args = msg.content.slice(config.prefixes.alt4.length).split(/ +/);
+ var command = args.shift().toLocaleLowerCase();
+
+ if (msg.author.bot || !msg.content.startsWith(config.prefixes.alt4)) return;
+ } else if (prefixCheck() == "alt4b") {
+ var args = msg.content.slice(config.prefixes.alt4b.length).split(/ +/);
+ var command = args.shift().toLocaleLowerCase();
+
+ if (msg.author.bot || !msg.content.startsWith(config.prefixes.alt4b)) return;
+ }
+
+ // Returns ping of bot
+ if (command == 'ping') {
+ const t = Date.now();
+
+ msg.channel.send('Please Wait...').then(m => {
+ m.edit(`** **`);
+
+ const n = Date.now();
+ let emb = new Discord.RichEmbed()
+
+ .setDescription(`Pong! s5nical's is \`${n - t}ms\`. Heartbeat \`${bot.ping}ms\`.`)
+ .setColor(0xffd296);
+
+ msg.channel.send(RichEmbed = emb);
+ });
+ }
+
+ function noargs() {
+ msg.channel.send(`Invalid argument(s)! Type \`${config.prefixes.main}help\` for more information.`);
+ }
+
+ function nocmd() {
+ msg.channel.send(`Invalid or unspecified command! Type \`${config.prefixes.main}help\``);
+ }
+
+ function perms(p) {
+ if (msg.member.hasPermission(p)) return true;
+ }
+
+ // 8ball feature
+ if (command == '8ball' || command == 'ball') {
+ r = ['Yes~ owo', 'No.', 'Yes!', 'No!', 'What, no.', 'Yes.', 'Maybe.', 'Perhaps.', 'Try again.', 'I\'m not sure.'];
+
+ var s = r[Math.floor(Math.random() * r.length)];
+
+ emb = new Discord.RichEmbed()
+
+ .setAuthor('The 8-ball says', 'https://upload.wikimedia.org/wikipedia/commons/thumb/f/fd/8-Ball_Pool.svg/500px-8-Ball_Pool.svg.png')
+ .setDescription('`' + s + '`');
+
+ msg.channel.send(RichEmbed = emb);
+ }
+
+ // Say feature, bot repeats what you say
+ if (command == 'say') {
+ if (msg.member.hasPermission('KICK_MEMBERS')) {
+ m = args.join(' ');
+ msg.channel.send(m);
+ msg.delete();
+ }
+ }
+
+ // Server info feature
+ if (command == 'server') {
+ var o = msg.guild.members.filter(m => m.presence.status === 'online').size;
+
+ emb = new Discord.RichEmbed()
+
+ .setAuthor(`${msg.guild.name} - ${msg.guild.id}`, `${msg.guild.iconURL}`, `https://discordapp.com/channels/${msg.guild.id}/${msg.guild.id}`)
+ .setDescription(`Here\'s all the information on \`${msg.guild.name}\``)
+ .setThumbnail(`${msg.guild.iconURL}`)
+ .addField('Owner', `${msg.guild.owner}`, false)
+ .addField(`Members [${msg.guild.memberCount}]`, `${o} members are online.`, true)
+ .addField('Region', `${msg.guild.region}`, true)
+ .addField('Text Channels', `${msg.guild.channels.filter(c => c.type === 'text').size}`, true)
+ .addField('Voice Channels', `${msg.guild.channels.filter(c => c.type === 'voice').size}`, true)
+ .addField('Guild Created', `${msg.guild.createdAt}`, false)
+ .addField('s5nical Joined', `${msg.guild.members.get('695107550403756192').joinedAt}`)
+ .setColor(0xffd296);
+
+ msg.channel.send(RichEmbed = emb);
+ }
+ } else if (msg.channel.name !== 'bots' && msg.content.startsWith(`${config.prefixes.main}`) && !msg.member.hasPermission('KICK_MEMBERS')) return;
+})
+
+bot.login(config['secret']) \ No newline at end of file
diff --git a/config.json b/config.json
new file mode 100644
index 0000000..522bd29
--- /dev/null
+++ b/config.json
@@ -0,0 +1,11 @@
+{
+ "secret":"Njk1MTA3NTUwNDAzNzU2MTky.XoVXcQ.JqQAhfqtYW-fz5nYCHvo13BjXAM",
+ "prefixes": {
+ "main":"s3n-",
+ "alt":"s3nical-",
+ "alt2":"s3n!",
+ "alt3":"s3nical! ",
+ "alt4":"<@!695107550403756192> ",
+ "alt4b":"<@695107550403756192> "
+ }
+} \ No newline at end of file
diff --git a/package.json b/package.json
new file mode 100644
index 0000000..33dbf0d
--- /dev/null
+++ b/package.json
@@ -0,0 +1,15 @@
+{
+ "name": "package",
+ "version": "1.0.0",
+ "description": "",
+ "main": "app.js",
+ "scripts": {
+ "test": "echo \"Error: no test specified\" && exit 1"
+ },
+ "author": "soggy",
+ "license": "MIT",
+ "dependencies": {
+ "discord.js": "^11.6.3",
+ "is-image-url": "^1.1.8"
+ }
+}