summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
author8cy <[email protected]>2020-04-15 08:10:26 -0700
committer8cy <[email protected]>2020-04-15 08:10:26 -0700
commit972c2ef86a59f0d90da9c11bcdfc9d7245379186 (patch)
tree69ef94319bae5f44f3438f409cea9a467d53d296 /src
parenton msg also log server name, v5.0.6 (diff)
downloaddep-core-972c2ef86a59f0d90da9c11bcdfc9d7245379186.tar.xz
dep-core-972c2ef86a59f0d90da9c11bcdfc9d7245379186.zip
The Uwulapse, v6.0.0
- add webserver - fix servercount - formatting
Diffstat (limited to 'src')
-rw-r--r--src/app.js5
-rw-r--r--src/bot.ts25
-rw-r--r--src/commands/utility/servercount.ts (renamed from src/commands/utility/servers.ts)10
-rw-r--r--src/commands/utility/uptime.ts2
-rw-r--r--src/ws/layouts/layout.hbs18
-rw-r--r--src/ws/public/css/main.css116
-rw-r--r--src/ws/views/error.hbs1
-rw-r--r--src/ws/views/index.hbs1
-rw-r--r--src/ws/ws.ts54
9 files changed, 221 insertions, 11 deletions
diff --git a/src/app.js b/src/app.js
index fca1bad..792c2f6 100644
--- a/src/app.js
+++ b/src/app.js
@@ -1,7 +1,8 @@
const { ShardingManager } = require('discord.js');
const config = require('./config.json');
-const manager = new ShardingManager('./dist/bot.js', { token: config['secret'] });
-//const manager = new ShardingManager('./bot.js', { token: config['secret'] });
+//const manager = new ShardingManager('./dist/bot.js', { token: config['secret'] });
+const manager = new ShardingManager('./bot.js', { token: config['secret'] });
manager.spawn();
+console.log('Connecting...');
manager.on('shardCreate', shard => console.log(`Launched shard: ${shard.id}`));
diff --git a/src/bot.ts b/src/bot.ts
index f8fc6b3..f8e075d 100644
--- a/src/bot.ts
+++ b/src/bot.ts
@@ -1,5 +1,6 @@
import config from './config.json';
import { CommandoClient } from 'discord.js-commando';
+import WS from './ws/ws';
import path from 'path';
import { Structures } from 'discord.js';
import emoji from 'emoji-random';
@@ -18,12 +19,14 @@ Structures.extend('Guild', Guild => {
}
return MusicGuild;
});
-
+//
const client = new CommandoClient({
commandPrefix: 'uwu!',
owner: '217348698294714370'
});
+var ws = new WS('123456', 5665, client)
+
client.registry
.registerDefaultTypes()
.registerGroups([
@@ -39,8 +42,24 @@ client.registry
.registerCommandsIn(path.join(__dirname, 'commands'));
client.once('ready', () => {
- console.log(`Started bot: ${client.user.tag} (ID: ${client.user.id})\nCurrently running on ${client.guilds.cache.size} server(s).`);
- client.user.setActivity('uwu!help | v5.0.0', {
+ //console.log(`Started bot: ${client.user.tag} (ID: ${client.user.id})\nCurrently running on ${client.guilds.cache.size} server(s).`);
+ console.log('Bot online!')
+ console.log(` _ _ __ _
+| | | | / _(_)
+| | | |_ ___ _| |_ _ ___ _ __
+| | | \\ \\ /\\ / / | | | _| |/ _ \\ '__|
+| |_| |\\ V V /| |_| | | | | __/ |
+ \\___/ \\_/\\_/ \\__,_|_| |_|\\___|_|
+
+ `)
+ console.log('discord.js Version: 2.1.1')
+ console.log('Node.js Version:', process.version)
+ console.log('OS Version:', process.platform)
+ console.log('Name:', `${client.user?.tag}`)
+ console.log('ID:', `${client.user?.id}`)
+ console.log()
+
+ client.user.setActivity('uwu!help | v6.0.0', {
type: 'WATCHING'
});
});
diff --git a/src/commands/utility/servers.ts b/src/commands/utility/servercount.ts
index 1b3ce0f..7e92247 100644
--- a/src/commands/utility/servers.ts
+++ b/src/commands/utility/servercount.ts
@@ -2,20 +2,20 @@ import { Command } from 'discord.js-commando';
import { MessageEmbed, Message } from 'discord.js';
import emoji from 'emoji-random';
-module.exports = class ServersUtility extends Command {
+module.exports = class ServerCountUtility extends Command {
constructor(client) {
super(client, {
- name: 'servers',
- aliases: ['servercount', 'scount', 'serverc'],
+ name: 'servercount',
+ aliases: ['sc', 'scount', 'serverc'],
group: 'utility',
- memberName: 'servers',
+ memberName: 'servercount',
description: 'Tells you the amount of servers uwufy is in.',
userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'],
clientPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY']
});
}
run(msg: Message) {
- msg.channel.send('Please wait..').then(m => {
+ msg.channel.send('Please wait...').then(m => {
m.edit(`** **`);
let emb = new MessageEmbed()
diff --git a/src/commands/utility/uptime.ts b/src/commands/utility/uptime.ts
index eebd031..1bea003 100644
--- a/src/commands/utility/uptime.ts
+++ b/src/commands/utility/uptime.ts
@@ -27,7 +27,7 @@ export default class UptimeUtility extends Command {
}
run(msg: Message) {
const duration = _duration(this.client.uptime).format(" D [days], H [hrs], m [mins], s [secs]");
- msg.channel.send('Please wait..').then(m => {
+ msg.channel.send('Please wait...').then(m => {
m.edit(`** **`);
let emb = new MessageEmbed()
diff --git a/src/ws/layouts/layout.hbs b/src/ws/layouts/layout.hbs
new file mode 100644
index 0000000..3cc34cd
--- /dev/null
+++ b/src/ws/layouts/layout.hbs
@@ -0,0 +1,18 @@
+<!DOCTYPE html>
+<html lang="en">
+ <head>
+ <meta charset="UTF-8">
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
+ <title>{{title}}</title>
+ <link rel="stylesheet" href="css/main.css">
+ </head>
+ <body>
+ <div title="Status">
+ {{body}}
+ </div>
+
+ <div class="footer">
+ <p>Copyright &COPY; 2020 - <a href="https://cyne.cf">s1nical</a></p>
+ </div>
+ </body>
+</html> \ No newline at end of file
diff --git a/src/ws/public/css/main.css b/src/ws/public/css/main.css
new file mode 100644
index 0000000..993c46a
--- /dev/null
+++ b/src/ws/public/css/main.css
@@ -0,0 +1,116 @@
+@import url('https://fonts.googleapis.com/css?family=Fira+Mono:400');
+
+body {
+ display: flex;
+ width: 100vw;
+ height: 100vh;
+ align-items: center;
+ justify-content: center;
+ margin: 0;
+ background: #131313;
+ color: #fff;
+ font-size: 96px;
+ font-family: 'Fira Mono', monospace;
+ letter-spacing: -7px;
+}
+
+div {
+ animation: glitch 1s linear infinite;
+}
+
+@keyframes glitch {
+
+ 2%,
+ 64% {
+ transform: translate(2px, 0) skew(0deg);
+ }
+
+ 4%,
+ 60% {
+ transform: translate(-2px, 0) skew(0deg);
+ }
+
+ 62% {
+ transform: translate(0, 0) skew(5deg);
+ }
+}
+
+div:before,
+div:after {
+ content: attr(title);
+ position: absolute;
+ left: 0;
+}
+
+div:before {
+ animation: glitchTop 1s linear infinite;
+ clip-path: polygon(0 0, 100% 0, 100% 33%, 0 33%);
+ -webkit-clip-path: polygon(0 0, 100% 0, 100% 33%, 0 33%);
+}
+
+@keyframes glitchTop {
+
+ 2%,
+ 64% {
+ transform: translate(2px, -2px);
+ }
+
+ 4%,
+ 60% {
+ transform: translate(-2px, 2px);
+ }
+
+ 62% {
+ transform: translate(13px, -1px) skew(-13deg);
+ }
+}
+
+div:after {
+ animation: glitchBotom 1.5s linear infinite;
+ clip-path: polygon(0 67%, 100% 67%, 100% 100%, 0 100%);
+ -webkit-clip-path: polygon(0 67%, 100% 67%, 100% 100%, 0 100%);
+}
+
+@keyframes glitchBotom {
+
+ 2%,
+ 64% {
+ transform: translate(-2px, 0);
+ }
+
+ 4%,
+ 60% {
+ transform: translate(-2px, 0);
+ }
+
+ 62% {
+ transform: translate(-22px, 5px) skew(21deg);
+ }
+}
+
+#green {
+ color: #05ffa1
+}
+
+a {
+ color: white;
+ text-decoration: none;
+ transition: 0.5s;
+}
+
+a:hover {
+ color: rgb(223, 222, 222);
+ text-decoration: none;
+ transition: 0.5s;
+}
+
+.footer {
+ position: fixed;
+ left: 0;
+ bottom: 0;
+ width: 100%;
+ color: white;
+ text-align: center;
+ font-size: 15px;
+ letter-spacing: -1px;
+} \ No newline at end of file
diff --git a/src/ws/views/error.hbs b/src/ws/views/error.hbs
new file mode 100644
index 0000000..fe49573
--- /dev/null
+++ b/src/ws/views/error.hbs
@@ -0,0 +1 @@
+Error: {{errtype}} \ No newline at end of file
diff --git a/src/ws/views/index.hbs b/src/ws/views/index.hbs
new file mode 100644
index 0000000..5253033
--- /dev/null
+++ b/src/ws/views/index.hbs
@@ -0,0 +1 @@
+Status: Online \ No newline at end of file
diff --git a/src/ws/ws.ts b/src/ws/ws.ts
new file mode 100644
index 0000000..08f9581
--- /dev/null
+++ b/src/ws/ws.ts
@@ -0,0 +1,54 @@
+import express from 'express';
+import hbs from 'express-handlebars';
+import bodyParser from 'body-parser';
+import path from 'path';
+
+class WebSocket {
+ constructor(token, port, client) {
+ this.token = token;
+ this.client = client;
+
+ this.app = express()
+ this.app.engine('hbs', hbs({
+ extname: 'hbs',
+ defaultLayout: 'layout',
+ layoutsDir: __dirname + '/layouts'
+ }))
+ this.app.set('views', path.join(__dirname, 'views'))
+ this.app.set('view engine', 'hbs')
+ this.app.use(express.static(path.join(__dirname, 'public')))
+ this.app.use(bodyParser.urlencoded({ extended: false }))
+ this.app.use(bodyParser.json())
+
+ this.registerRoots()
+
+ this.server = this.app.listen(port, () => {
+ console.log(`Websocket listening on port ${this.server.address().port}`)
+ })
+ }
+
+ checkToken(_token) {
+ return (_token == this.token)
+ }
+
+ // http://localhost:port?token=123456
+ registerRoots() {
+ this.app.get('/', (req, res) => {
+ var _token = req.query.token
+ // if (!this.checkToken(_token)) {
+ // res.render('error', {
+ // title: 's1nical - Error',
+ // errtype: 'INVALID TOKEN'
+ // })
+ // return
+ // }
+
+ res.render('index', {
+ title: 'Uwufier - Status',
+ token: _token
+ })
+ })
+ }
+}
+
+module.exports = WebSocket \ No newline at end of file