summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
author8cy <[email protected]>2020-05-05 17:20:56 -0700
committer8cy <[email protected]>2020-05-05 17:20:56 -0700
commita9736fde2706e37aac691184e78f7686e1dd76aa (patch)
tree941e121d9df6bf56e0bef3e9f887cbc56a843946 /src
parentupdate dependencies (diff)
downloaddep-core-a9736fde2706e37aac691184e78f7686e1dd76aa.tar.xz
dep-core-a9736fde2706e37aac691184e78f7686e1dd76aa.zip
add api, change sementic version tag
because of adding an api, a change was need to Procfile, making it a web process in heroku i also removed unused dependencies from the webserver file and made responses into json objects dont worry, i am using uptime robot ;) - renamed ws to server -changed sementic version from v10.0.0 to v1.10.0, minecraft versions :D
Diffstat (limited to 'src')
-rw-r--r--src/bot.ts4
-rw-r--r--src/config.json2
-rw-r--r--src/server.ts35
3 files changed, 38 insertions, 3 deletions
diff --git a/src/bot.ts b/src/bot.ts
index 337a772..8334cc8 100644
--- a/src/bot.ts
+++ b/src/bot.ts
@@ -1,6 +1,6 @@
import config from './config.json';
import { CommandoClient } from 'discord.js-commando';
-//import WS from './ws/ws';
+import WS from './server';
import Welcome from './models/welcome.js';
import Goodbye from './models/goodbye.js';
import mongoose from 'mongoose';
@@ -16,7 +16,7 @@ const client = new CommandoClient({
invite: 'https://discord.gg/DVwXUwx'
});
-//var ws = new WS('123456', process.env.PORT, client)
+const ws = new WS(process.env.PORT, client)
client.registry
.registerDefaultTypes()
diff --git a/src/config.json b/src/config.json
index 8dc7da6..9cdd651 100644
--- a/src/config.json
+++ b/src/config.json
@@ -1,7 +1,7 @@
{
"secret":"Njk5NDczMjYzOTk4MjcxNDg5.XpU5oQ.btZuxVudhNllSQY6CxrXXtMJm9A",
"yt-api-key":"AIzaSyCeG1lQAeInv4vjFv_eTL9IFAFNdQC9Nk8",
- "version":"9.3.2",
+ "version":"1.10.0",
"fortniteTrackerNetworkToken": "4cf21f95-5f1a-412a-b4a7-e5424adc314a",
"maxMultipler": 100,
"minMultipler": 1.01
diff --git a/src/server.ts b/src/server.ts
new file mode 100644
index 0000000..b216ff4
--- /dev/null
+++ b/src/server.ts
@@ -0,0 +1,35 @@
+import express from 'express';
+import bodyParser from 'body-parser';
+
+class WebSocket {
+ constructor(port, client) {
+ this.client = client;
+
+ this.app = express()
+ this.app.use(bodyParser.urlencoded({ extended: false }))
+ this.app.use(bodyParser.json())
+
+ this.registerRoots()
+
+ this.server = this.app.listen(port, () => {
+ console.log('\x1b[0m' + 'Listening on port: ' + '\x1b[36m' + this.server.address().port)
+ })
+ }
+ // http://localhost:port?token=123456
+ registerRoots() {
+ this.app.get('/', (req, res) => {
+ res.redirect('https://kyzer.co/discord/bots/uwufier/')
+ })
+ this.app.get('/api/v1/commands/', async (req, res) => {
+ res.json({ guilds: await this.client.registry.commands.size })
+ });
+ this.app.get('/api/v1/commands/groups/', async (req, res) => {
+ res.json({ guilds: await this.client.registry.groups.size })
+ });
+ this.app.get('/api/v1/servers/', async (req, res) => {
+ res.json({ guilds: await this.client.guilds.cache.size })
+ });
+ }
+}
+
+module.exports = WebSocket \ No newline at end of file