From 972c2ef86a59f0d90da9c11bcdfc9d7245379186 Mon Sep 17 00:00:00 2001 From: 8cy <50817549+8cy@users.noreply.github.com> Date: Wed, 15 Apr 2020 08:10:26 -0700 Subject: The Uwulapse, v6.0.0 - add webserver - fix servercount - formatting --- src/app.js | 5 +- src/bot.ts | 25 +++++++- src/commands/utility/servercount.ts | 28 +++++++++ src/commands/utility/servers.ts | 28 --------- src/commands/utility/uptime.ts | 2 +- src/ws/layouts/layout.hbs | 18 ++++++ src/ws/public/css/main.css | 116 ++++++++++++++++++++++++++++++++++++ src/ws/views/error.hbs | 1 + src/ws/views/index.hbs | 1 + src/ws/ws.ts | 54 +++++++++++++++++ 10 files changed, 244 insertions(+), 34 deletions(-) create mode 100644 src/commands/utility/servercount.ts delete mode 100644 src/commands/utility/servers.ts create mode 100644 src/ws/layouts/layout.hbs create mode 100644 src/ws/public/css/main.css create mode 100644 src/ws/views/error.hbs create mode 100644 src/ws/views/index.hbs create mode 100644 src/ws/ws.ts (limited to 'src') 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/servercount.ts b/src/commands/utility/servercount.ts new file mode 100644 index 0000000..7e92247 --- /dev/null +++ b/src/commands/utility/servercount.ts @@ -0,0 +1,28 @@ +import { Command } from 'discord.js-commando'; +import { MessageEmbed, Message } from 'discord.js'; +import emoji from 'emoji-random'; + +module.exports = class ServerCountUtility extends Command { + constructor(client) { + super(client, { + name: 'servercount', + aliases: ['sc', 'scount', 'serverc'], + group: 'utility', + 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 => { + m.edit(`** **`); + + let emb = new MessageEmbed() + .setDescription(`Currently running on 31${this.client.guilds.cache.size} server(s). ` + emoji.random()) + .setColor(0xFFCC4D) + + msg.channel.send(emb); + }); + } +}; \ No newline at end of file diff --git a/src/commands/utility/servers.ts b/src/commands/utility/servers.ts deleted file mode 100644 index 1b3ce0f..0000000 --- a/src/commands/utility/servers.ts +++ /dev/null @@ -1,28 +0,0 @@ -import { Command } from 'discord.js-commando'; -import { MessageEmbed, Message } from 'discord.js'; -import emoji from 'emoji-random'; - -module.exports = class ServersUtility extends Command { - constructor(client) { - super(client, { - name: 'servers', - aliases: ['servercount', 'scount', 'serverc'], - group: 'utility', - memberName: 'servers', - 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 => { - m.edit(`** **`); - - let emb = new MessageEmbed() - .setDescription(`Currently running on 31${this.client.guilds.cache.size} server(s). ` + emoji.random()) - .setColor(0xFFCC4D) - - msg.channel.send(emb); - }); - } -}; \ No newline at end of file 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 @@ + + +
+ + +