Skip to content
This repository was archived by the owner on Feb 24, 2026. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
6c31f2a
not entirely sure if the leave one is working but hey the join messag…
ATXLtheAxolotl Nov 17, 2022
18e1d16
uh i forget what I did and I don't wanna look back at what I did I ju…
ATXLtheAxolotl Nov 17, 2022
07b1cc8
drippy chat relay
ATXLtheAxolotl Nov 18, 2022
70759de
/status command update
ATXLtheAxolotl Nov 18, 2022
b60d21c
/status images
ATXLtheAxolotl Nov 20, 2022
a181684
Names for /status
ATXLtheAxolotl Nov 21, 2022
b255d9a
add very important issue
ATXLtheAxolotl Nov 21, 2022
9a549c3
oh it has to be a url okay Markdown!!!
ATXLtheAxolotl Nov 21, 2022
9d2d829
Remove unnecessary characters
ATXLtheAxolotl Nov 21, 2022
2891165
Added comments for easier understanding
XeynQ4 Nov 21, 2022
b4cb339
Merge pull request #1 from XeynQ4/main
ATXLtheAxolotl Nov 22, 2022
64271c8
Merge branch 'main' into main
ATXLtheAxolotl Nov 22, 2022
f71f571
Use specific version of minecraft-protocol
ATXLtheAxolotl Nov 22, 2022
9ba2337
The Great De-dripization
ATXLtheAxolotl Nov 22, 2022
aefb67a
add constants to config.d.ts
ATXLtheAxolotl Nov 22, 2022
5daad47
clean(PlayerAPI): Remove PlayerAPI class and only use Player class
ATXLtheAxolotl Nov 23, 2022
cea2631
clean(): Use loweCamalCase for function names.
ATXLtheAxolotl Nov 23, 2022
e378295
clean(): Rename checksrv() to checkSRV()
ATXLtheAxolotl Nov 23, 2022
a1d2f6f
add(): Logo.jpg
ATXLtheAxolotl Nov 23, 2022
507228d
fix(): Use URL defined in config
ATXLtheAxolotl Nov 23, 2022
b3ad61a
fix(): Use URL's from GitHub rather than Youtube.
ATXLtheAxolotl Nov 23, 2022
e934d7b
clean(): Use full names in config
ATXLtheAxolotl Nov 24, 2022
cb66543
Merge branch 'main' into main
ATXLtheAxolotl Nov 24, 2022
80ac37b
add(): Long mute list of N00b's
ATXLtheAxolotl Nov 24, 2022
f1c7436
Merge branch 'main' of https://github.com/ATXLtheAxolotl/liveunderflow
ATXLtheAxolotl Nov 24, 2022
9d53ee1
fix(): Add a ?
ATXLtheAxolotl Nov 24, 2022
a64f383
feat(): crappy cache
ATXLtheAxolotl Nov 25, 2022
313f185
fix(): Correct time in a comment.
ATXLtheAxolotl Nov 25, 2022
9e0b459
fix(README): Check off #3 because this resolves it.
ATXLtheAxolotl Nov 25, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -105,3 +105,7 @@ dist

# TernJS port file
.tern-port

# Custom
Minecraft/auth/
Minecraft/cache/
4 changes: 2 additions & 2 deletions Commands/admin/reload.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { ChatInputCommandInteraction, SlashCommandBuilder } from 'discord.js';
import { loadCommands } from '../../Handlers/commandHandler';
import { loadEvents } from '../../Handlers/eventHandler';
import { DrippyClient } from '../../Utils/DrippyClient';
import { DiscordClient } from '../../Utils/DiscordClient';

export const developer = true;

Expand All @@ -12,7 +12,7 @@ export const data = new SlashCommandBuilder()
.addSubcommand((options) => options.setName('events').setDescription('Reload Events'))
.addSubcommand((options) => options.setName('commands').setDescription('Reload Commands'))

export function execute(interaction: ChatInputCommandInteraction, client: DrippyClient) {
export function execute(interaction: ChatInputCommandInteraction, client: DiscordClient) {
const subCommand = interaction.options.getSubcommand();

switch(subCommand) {
Expand Down
4 changes: 2 additions & 2 deletions Commands/general/apply.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { ChatInputCommandInteraction, SlashCommandBuilder, ActionRowBuilder, ModalBuilder, TextInputBuilder, TextInputStyle } from "discord.js";
import { DrippyClient } from "../../Utils/DrippyClient";
import { DiscordClient } from "../../Utils/DiscordClient";

export const data = new SlashCommandBuilder()
.setName('apply')
.setDescription('Apply for the rw role!')

export async function execute(interaction: ChatInputCommandInteraction, client: DrippyClient) {
export async function execute(interaction: ChatInputCommandInteraction, client: DiscordClient) {
const modal = new ModalBuilder()
.setCustomId(`application`)
.setTitle(`RW Application`);
Expand Down
4 changes: 2 additions & 2 deletions Commands/general/check.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { SlashCommandBuilder, EmbedBuilder, ChatInputCommandInteraction, User } from 'discord.js';
import { DrippyClient } from '../../Utils/DrippyClient';
import { DiscordClient } from '../../Utils/DiscordClient';

export const data = new SlashCommandBuilder()
.setName('check')
.setDescription('Do you have the right ip? Check with this command')
.addStringOption((o) => o.setName(`ip`).setDescription(`Put the ip here (no port needed!)`).setRequired(true))

export function execute(interaction: ChatInputCommandInteraction, client: DrippyClient) {
export function execute(interaction: ChatInputCommandInteraction, client: DiscordClient) {
const user = interaction.member?.user
if(!(user instanceof User)) return;

Expand Down
4 changes: 2 additions & 2 deletions Commands/general/ping.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { SlashCommandBuilder, EmbedBuilder, ChatInputCommandInteraction } from 'discord.js';
import { DrippyClient } from '../../Utils/DrippyClient';
import { DiscordClient } from '../../Utils/DiscordClient';

export const data = new SlashCommandBuilder()
.setName('ping')
.setDescription('A simple ping command!')

export async function execute(interaction: ChatInputCommandInteraction, client: DrippyClient) {
export async function execute(interaction: ChatInputCommandInteraction, client: DiscordClient) {
const date = Date.now()
const embed = new EmbedBuilder()
.setTitle('🟢 Pong!')
Expand Down
55 changes: 49 additions & 6 deletions Commands/general/status.ts
Original file line number Diff line number Diff line change
@@ -1,19 +1,23 @@
import { SlashCommandBuilder, EmbedBuilder, ActivityType, ChatInputCommandInteraction } from 'discord.js';
import axios from 'axios';
import { DrippyClient } from '../../Utils/DrippyClient';
import { resolve } from 'path';
import { SlashCommandBuilder, EmbedBuilder, ActivityType, ChatInputCommandInteraction, AttachmentBuilder } from 'discord.js';
import { DiscordClient } from '../../Utils/DiscordClient';
import Jimp, { read, MIME_PNG } from 'jimp';
import { Player } from '../../Minecraft/Player';
import { groupByN } from '../../Utils/Sort';

export const data = new SlashCommandBuilder()
.setName('status')
.setDescription('Check the server status!');

export async function execute(interaction: ChatInputCommandInteraction, client: DrippyClient) {
export async function execute(interaction: ChatInputCommandInteraction, client: DiscordClient) {
await interaction.deferReply({
ephemeral: true
})

const embed = new EmbedBuilder()
const guild = await client.guilds.cache.find(g => g.id === client.config.guild.id)
const channel = await guild?.channels.cache.find(c => c.id === client.config.guild.channels.statchan);
const channel = await guild?.channels.cache.find(c => c.id === client.config.guild.channels.stat_channel);

try {
const ip = client.config.ips.main;
Expand All @@ -31,7 +35,10 @@ export async function execute(interaction: ChatInputCommandInteraction, client:
} else {
client.user?.setActivity(`${data.players.online}/${data.players.max} players`, { type: ActivityType.Watching });
embed.setTitle(`LiveOverflow SMP • ${data.players.online}/${data.players.max}`)
embed.setDescription(`Current server status`)
if(client.config['in-game-bot'].enabled) embed.setImage(`attachment://tab.png`)
else embed.setDescription(`Current server status.`)


if(data.players.online >= data.players.max) {
channel?.setName(`🟠 ${data.players.online}/${data.players.max} Players`)
client.user?.setStatus('idle');
Expand All @@ -46,7 +53,43 @@ export async function execute(interaction: ChatInputCommandInteraction, client:
console.error(error)
}

interaction.editReply({
if(client.config['in-game-bot'].enabled) interaction.editReply({
embeds: [embed],
files: [await renderTabImage(client.bot.playerManager.getPlayerArray())]
})
else interaction.editReply({
embeds: [embed],
})
}

async function renderTabImage(players: Player[]) {
players = players.filter((player) => !player.name.startsWith('N00bBot'));

const rows = 5;
const grouping = groupByN(rows, players)
const canvas = await read((rows * 180) + (rows * 20), (grouping.length * 180) + grouping.length * 60, '#2C2F33');
const font = await Jimp.loadFont(resolve('./Minecraft/Font/xsJGJPdTmfYtAZNHX7Kk5tfJ.ttf.fnt'));

for(var i = 0; i < grouping.length; i++) {
const group = grouping[i];
for(var l = 0; l < group.length; l++) {
const player = group[l];

const image = await player.downloadImage();

if(!image) continue;
const mathX = (l * 180) + (l * 20) + 10;
const mathY = (i * 180) + (i * 60) + 30;
canvas.composite(image, mathX, mathY);
const layer = await Jimp.read(Math.round(25 * player.name.length), 180);
const text = layer.print(font, 0, 0, player.name, 180, 180);
text.color([{ apply: 'xor', params: ['#FFFFFF'] }]);
text.scaleToFit(205, 100);
canvas.composite(text, mathX, player.name.length > 8 ? mathY - 45 : mathY - 25);
//text.resize(Math.round(22.5 * player.name.length), 25);
}
}

const imageBuffer = await canvas.getBufferAsync(MIME_PNG);
return new AttachmentBuilder(imageBuffer, { name: 'tab.png' })
}
8 changes: 4 additions & 4 deletions Commands/general/vouch.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import { SlashCommandBuilder, EmbedBuilder, ChatInputCommandInteraction, GuildMemberRoleManager } from 'discord.js';
import { DrippyClient } from '../../Utils/DrippyClient';
import { DiscordClient } from '../../Utils/DiscordClient';

export const data = new SlashCommandBuilder()
.setName('vouch')
.setDescription('Vouch for someone else to get the rw role!')
.addUserOption((o) => o.setName(`user`).setDescription(`Who do you want to vouch for?`).setRequired(true))


export async function execute(interaction: ChatInputCommandInteraction, client: DrippyClient) {
export async function execute(interaction: ChatInputCommandInteraction, client: DiscordClient) {
const embed = new EmbedBuilder()

//@ts-ignore
Expand Down Expand Up @@ -36,12 +36,12 @@ export async function execute(interaction: ChatInputCommandInteraction, client:
return true;
}

member.roles.add(interaction.guild.roles.cache.find(r => r.id === client.config.guild.roles.rw))
member.roles.add(interaction.guild?.roles.cache.find(r => r.id === client.config.guild.roles.rw))
embed.setTitle(`Thanks for vouching!`);
embed.setDescription(`The member has recieved their role!`);
embed.setColor(`Green`);

const chan = client.channels.cache.find(c => c.id === client.config.guild.channels.logchan)
const chan = client.channels.cache.find(c => c.id === client.config.guild.channels.log_channel)
//@ts-ignore
chan?.send({
//@ts-ignore
Expand Down
12 changes: 6 additions & 6 deletions Events/Client/ready.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import { loadCommands } from '../../Handlers/commandHandler';
import axios from 'axios';
import { ActivityType } from 'discord.js';
import { DrippyClient } from '../../Utils/DrippyClient';
import { DiscordClient } from '../../Utils/DiscordClient';

export const name = "ready";
export const once = true;
export async function execute(client: DrippyClient) {
async function checksrv() {
export async function execute(client: DiscordClient) {
async function checkSRV() {
try {
const guild = await client.guilds.cache.find(g => g.id === client.config.guild.id)
const channel = await guild?.channels.cache.find(c => c.id === client.config.guild.channels.statchan);
const channel = await guild?.channels.cache.find(c => c.id === client.config.guild.channels.stat_channel);
const ip = client.config.ips.main;
const url = `https://api.mcsrvstat.us/2/${ip}`;

Expand All @@ -34,11 +34,11 @@ export async function execute(client: DrippyClient) {
}

loadCommands(client);
checksrv()
checkSRV()
console.log(` ⚪ - ${client.user?.tag} ready!`);
client.user?.setActivity('the Server', { type: ActivityType.Watching });

setInterval(async () => {
await checksrv()
await checkSRV()
}, client.config.autodata.delay * 1000)
}
6 changes: 3 additions & 3 deletions Events/Interactions/ButtonUse.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { ActionRowBuilder, ButtonBuilder, ButtonStyle, PermissionFlagsBits, EmbedBuilder, TextChannel } from 'discord.js';
import { setTimeout } from 'node:timers/promises';
import { DrippyClient } from '../../Utils/DrippyClient';
import { DiscordClient } from '../../Utils/DiscordClient';
const wait = setTimeout;

export const name = "interactionCreate";
export async function execute(interaction, client: DrippyClient) {
export async function execute(interaction, client: DiscordClient) {
if(!interaction.isButton()) return;
const chan = client.channels.cache.find(c => c.id === client.config.guild.channels.logchan)
const chan = client.channels.cache.find(c => c.id === client.config.guild.channels.log_channel)

if(interaction.customId === `apply:close`) {
if(!interaction.member.permissions.has(PermissionFlagsBits.ManageChannels)) {
Expand Down
6 changes: 3 additions & 3 deletions Events/Interactions/ModalSubmit.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { EmbedBuilder } from '@discordjs/builders';
import { ChannelType, PermissionFlagsBits, ActionRowBuilder, ButtonBuilder, ButtonStyle, CategoryChannel } from 'discord.js';
import { DrippyClient } from '../../Utils/DrippyClient';
import { DiscordClient } from '../../Utils/DiscordClient';

export const name = "interactionCreate";
export async function execute(interaction, client: DrippyClient) {
export async function execute(interaction, client: DiscordClient) {
if(!interaction.isModalSubmit()) return;

if(interaction.customId === `application`) {
Expand All @@ -18,7 +18,7 @@ export async function execute(interaction, client: DrippyClient) {
)
.setTimestamp()

const cat = client.channels.cache.find(c => c.id === client.config.guild.channels.appcat) as CategoryChannel
const cat = client.channels.cache.find(c => c.id === client.config.guild.channels.app_category) as CategoryChannel
const chan = await cat?.children?.create({
name: `${interaction.member.user.tag}`,
type: ChannelType.GuildText,
Expand Down
4 changes: 2 additions & 2 deletions Events/Interactions/SlashCommands.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { ChatInputCommandInteraction } from 'discord.js';
import { DrippyClient } from '../../Utils/DrippyClient';
import { DiscordClient } from '../../Utils/DiscordClient';

export const name = "interactionCreate";
export function execute(interaction: ChatInputCommandInteraction, client: DrippyClient) {
export function execute(interaction: ChatInputCommandInteraction, client: DiscordClient) {
if(!interaction.isChatInputCommand()) return;

const command = client.commands.get(interaction.commandName);
Expand Down
4 changes: 2 additions & 2 deletions Events/Messages/MessageCreate.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { DrippyClient } from "../../Utils/DrippyClient"
import { DiscordClient } from "../../Utils/DiscordClient"

export const name = "messageCreate"
export function execute(message, client: DrippyClient) {
export function execute(message, client: DiscordClient) {
if(blacklist(message.content)) {
message.delete()
message.channel.send({content: `:x: Your message contained a blacklisted phase ${message.member.tag}`})
Expand Down
9 changes: 9 additions & 0 deletions Functions/uploadImage.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import Jimp, { MIME_PNG } from "jimp";
import { DiscordClient } from "../Utils/DiscordClient";
import { AttachmentBuilder } from 'discord.js';

export async function uploadImage(image: Jimp, client: DiscordClient) {
const buffer = await image.getBufferAsync(MIME_PNG);
const attachment = new AttachmentBuilder(buffer, { name: 'image.png' });
return client.sendAttachments(client.config.guild.channels.cache_channel, [ attachment ]);
}
4 changes: 2 additions & 2 deletions Handlers/commandHandler.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { loadFiles } from "../Functions/fileLoader";
import { DrippyClient } from "../Utils/DrippyClient";
import { DiscordClient } from "../Utils/DiscordClient";

export async function loadCommands(client: DrippyClient) {
export async function loadCommands(client: DiscordClient) {
const ascii = require('ascii-table');
const table = new ascii().setHeading('Commands', 'Status');

Expand Down
4 changes: 2 additions & 2 deletions Handlers/eventHandler.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { loadFiles } from "../Functions/fileLoader";
import { DrippyClient } from "../Utils/DrippyClient";
import { DiscordClient } from "../Utils/DiscordClient";

export async function loadEvents(client: DrippyClient) {
export async function loadEvents(client: DiscordClient) {
const ascii = require("ascii-table");
const table = new ascii().setHeading("Events", "Status");

Expand Down
Binary file added Media/Logo.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
50 changes: 50 additions & 0 deletions Minecraft/Bot.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
import { createClient } from '../Utils/MinecraftClient';
import { DiscordClient } from '../Utils/DiscordClient';
import { handleChat } from './Chat';
import { PlayerManager } from './PlayerManager';
import { ProfileCache } from './ProfileCache';

export function handleMinecraft(client: DiscordClient) {
if (!client.config['in-game-bot'].enabled) return; // Returns if there is no bot config
client.bot = createClient({
host: client.config.ips.n00b,
port: 25565,
username: 'sysctl',
profilesFolder: __dirname + '\\auth',
auth: 'microsoft',
disableChatSigning: true
}); // Creates the bot

client.bot.profileCache = new ProfileCache(client);
client.bot.playerManager = new PlayerManager(client);

client.bot.on('disconnect', (packet) => {
console.log('Disconnected from server : ' + packet.reason);
reconnectToServer(client);
}); // Sends log message when the bot disconnects from the server and reconnects it

client.bot.on('end', () => {
console.log('Connection lost');
reconnectToServer(client);
}); // Sends log message when the bot loses connection to the server and reconnects it

client.bot.on('error', (err) => {
if (err.message.includes('play.toClient')) return;
console.log('Error occurred');
console.log(err);
}); // Sends log message when the bot encounters an error

client.bot.on('connect', () => {
console.log(`Connected to Server...`);
handleChat(client);
}); // Sends log message when the bot connects to the server
}

// Waits a minute and tries to reconnect to the server
function reconnectToServer(client: DiscordClient) {
console.log('Reconnecting in 60 seconds...');
setTimeout(() => {
console.log('Attempting to connect...');
client.bot = createClient(client.bot.options);
}, 1000 * 60);
}
Loading