First push of code to the repo

This commit is contained in:
Junior 2020-04-03 12:47:15 -04:00
parent 4e271245ce
commit c73ad70b18
8 changed files with 1136 additions and 0 deletions

32
.gitignore vendored Normal file
View File

@ -0,0 +1,32 @@
# OS generated files
.DS_Store
.DS_Store?
._*
.Trashes
Thumbs.db
# The node modules
node_modules/
# The active config file copied from config-dist.js and servers-dist.js
config/config.js
config/servers.js
# Vim
*.swp
*.swo
# SQLite
*.sqlite
# sass generated files
.sass-cache/
install/.sass-cache/
compressed
*.map
# IDE generated
.idea/
# Authorize.net SDK
vendor/

6
config/config-dist.js Normal file
View File

@ -0,0 +1,6 @@
const config = {
BOT_TOKEN: 'YOUR_BOT_TOKEN_GOES_HERE',
CHANNELS_ALLOW: ['123456789012345678', '123456789012345678']
}
module.exports = config;

15
config/servers-dist.js Normal file
View File

@ -0,0 +1,15 @@
const servers = [
{
slug: 'myserverslug', // Doesn't have to be an actual Technic Platform slug
name: 'MyServer', // The "display name" for the pack
platformURL: "https://www.mypack.net/mypack/", // The URL for the site or page detailing the pack
mcVersion: '1.7.10', // The MC version the pack is built on
iconURL: 'https://www.mypack.net/resources/mypack/icon.png', // The URL to the icon for the pack
description: "This can be a short paragraph describing the details of the modpack",
addressPrimary: 'mypack.servers.info', // The primary address to use for the server
addressSecondary: 'servers.info:25565', // The secondary address. Some clients have trouble with SRV records
active: true // Is the server "active". Inactive servers are not listed by default
}
]
module.exports = servers;

BIN
images/botlogo_large.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 149 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 151 KiB

56
index.js Normal file
View File

@ -0,0 +1,56 @@
const Config = require('./config/config.js');
const Servers = require('./config/servers.js');
const Discord = require('discord.js');
const client = new Discord.Client();
client.on('ready', () => {
console.log(`Logged in as ${client.user.tag}!`);
});
let last = "";
client.on('message', msg => {
if ( msg.content.startsWith(">>servers") && Config.CHANNELS_ALLOW.includes(msg.channel.id) ) {
let embed = new Discord.MessageEmbed()
.setTitle("Here's a list of our current servers...")
.setColor(0xFFaaaa);
Servers.forEach(function (server) {
embed.addField("**" + server.name + "** *(" + server.slug + ")*", server.description);
});
embed.setFooter("Get more info on a pack with: >>server slug\nThe slugs are in parenthesis above");
msg.channel.send(embed);
}
if ( msg.content == ">>server" ) {
msg.channel.send("**Usage:** >>server *slug*");
}
if ( msg.content.startsWith(">>server ") && Config.CHANNELS_ALLOW.includes(msg.channel.id) ) {
let cmdParts = msg.content.split(" ");
let server = Servers.find(element => element.slug == cmdParts[1]);
if ( server ) {
let embed = new Discord.MessageEmbed()
.setTitle(server.name + " *(" + server.slug + ")*")
.setDescription(server.description)
.setURL(server.platformURL)
.setThumbnail(server.iconURL)
.setColor(0xffaaaa)
.addField("**MC Version:**", server.mcVersion, true)
.addField("**Server Address:**", server.addressPrimary, true)
.addField("**Server Alternate:**", server.addressSecondary, true);
msg.channel.send(embed);
} else {
if ( cmdParts[1] ) {
msg.channel.send("No server with the slug \"" + cmdParts[1] + "\" exists");
} else {
msg.channel.send("**Usage:** >>server *slug*");
}
}
}
});
client.login(Config.BOT_TOKEN);
// vim: ts=4:sw=4

1000
package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

27
package.json Normal file
View File

@ -0,0 +1,27 @@
{
"name": "circlebot",
"version": "1.0.0",
"main": "index.js",
"scripts": {
"start": "node index.js",
"dev": "nodemon index.js"
},
"author": "PlowmanPlow",
"repository": "",
"license": "GPL-2.0-only",
"description": "Discord Bot for CircleCraft",
"dependencies": {
"async-limiter": "^2.0.0",
"discord.js": "^12.1.1",
"long": "^4.0.0",
"prism-media": "^1.2.1",
"node-fetch": "^2.6.0",
"tweetnacl": "^1.0.3",
"ws": "^7.2.3",
"moment": "^2.24.0",
"rcon-client": "^4.2.0"
},
"devDependencies": {
"nodemon": "^2.0.2"
}
}