added frankenbot

This commit is contained in:
2022-09-26 22:25:50 +02:00
parent 447b2fb51d
commit 4f66fb8698
16 changed files with 1818 additions and 1 deletions

View File

@ -0,0 +1,25 @@
const Discord = require('discord.js');
const ms = require('ms');
module.exports.run = async function(bot, message, args){
message.delete();
//if (!message.member.hasPermission("KICK_MEMBERS")) return message.channel.send("You do not have the needed permission");
let toRemove = parseInt(args[0]);
if(args[0] > 200) return message.channel.send("Invalid arguments");
setTimeout(function () {
message.channel.bulkDelete(args[0])
.then(message.channel.send(`Ich habe ${toRemove} Nachrichten gelöscht!`)
.then(msg => {
setTimeout(() => {
msg.delete();
},5000)
})
);
}, ms("500ms"));
}
module.exports.help = {
name: "clear"
}

View File

@ -0,0 +1,27 @@
const { MessageEmbed } = require('discord.js');
module.exports.run = async function(bot, message, args){
message.delete();
// TODO: Figure out how to setup the helppage properly
const userEmbed = new MessageEmbed()
.setColor('#0099ff')
.setTitle('Frankenbot Help')
.setURL('https://frankenbot.io/help')
.setAuthor({ name: 'Frankenbot', iconURL: "https://cdn.slpnetwork.de/img/sys/users/frankenbot.png", url: 'https://frankenbot.io' })
.setDescription('A List of Commands for Frankenbot')
.setThumbnail("https://cdn.slpnetwork.de/img/sys/users/frankenbot.png")
.addFields(
{ name: '**Help**', value: '`!help`' },
)
.setFooter({ text: 'commands are used as !<command in lowercase>', iconURL: "https://cdn.slpnetwork.de/img/sys/users/frankenbot.png" });
message.channel.send({ embeds: [userEmbed] }).then(msg => {
setTimeout(() => {
msg.delete();
},5000);
}).catch(err => console.error(err));
}
module.exports.help = {
name: "help"
}

View File

@ -0,0 +1,10 @@
const { MessageEmbed } = require('discord.js');
module.exports.run = async function(bot, message, args){
message.delete();
// select settings object from existing storage
}
module.exports.help = {
name: "settings"
}

View File

@ -0,0 +1,97 @@
const { MessageAttachment } = require('discord.js');
const Canvas = require('canvas');
module.exports.run = async function(bot, message, args){
// Create a 700x250 pixel canvas and get its context
// The context will be used to modify the canvas
const canvas = Canvas.createCanvas(700, 250);
const context = canvas.getContext('2d');
const background = await Canvas.loadImage('./background.png');
const avatar = await Canvas.loadImage(message.author.displayAvatarURL({ format: 'jpg' }));
const progressWidth = 400;
let type = "image";
let xp = 300;
let max = 1500;
let perc = ((xp/max)*100)/100;
let prog = Math.floor(progressWidth*(perc-4));
let position;
let text;
let correction = 0;
if(type == "image") {
context.drawImage(background, 0, 0, canvas.width, canvas.height);
} else if(type === "solid") {
context.fillStyle = "#2d3436";
context.fillRect(0, 0, canvas.width, canvas.height);
}
// Set the color of the stroke
context.strokeStyle = '#0099ff';
// Select the font size and type from one of the natively available fonts
context.font = '40px sans-serif';
// Select the style that will be used to fill the text in
context.fillStyle = '#ffffff';
// Actually fill the text with a solid color
context.fillText(message.member.displayName, canvas.width / 2.5, canvas.height / 2);
// Select the font size and type from one of the natively available fonts
text = xp + "/" + max + "xp";
context.font = '25px sans-serif';
position = (canvas.width / 1.225);
// correcting level text overflow
if(canvas.width - ((canvas.width / 1.225) + context.measureText(text).width) <= 23){
correction = (canvas.width - ((canvas.width / 1.225) + context.measureText(text).width)) - 24;
}
context.fillText(text, position + correction, canvas.height / 2);
// rank banner
// Select the font size and type from one of the natively available fonts
context.font = '30px sans-serif';
position = (canvas.width / 1.225);
text = "Level 300";
correction = 0;
// correcting level text overflow
if(canvas.width - ((canvas.width / 1.225) + context.measureText(text).width) <= 23){
correction = (canvas.width - ((canvas.width / 1.225) + context.measureText(text).width)) - 24;
}
context.fillText(text, position + correction, canvas.height / 4);
// progressbar
context.fillStyle = '#636e72';
context.fillRect(canvas.width / 2.5, canvas.height / 1.8, progressWidth, 50);
context.moveTo(220, 200);
context.fillStyle = '#2d3436';
if(prog < 0) {prog = Math.floor(progressWidth*perc);}
context.fillRect(canvas.width / 2.5 + 2, (canvas.height / 1.8) + 3, prog, 44);
// Pick up the pen
context.beginPath();
// Start the arc to form a circle
context.arc(125, 125, 100, 0, Math.PI * 2, true);
// Put the pen down
context.closePath();
// Clip off the region you drew on
context.clip();
// Move the image downwards vertically and constrain its height to 200, so that it's square
context.drawImage(avatar, 25, 25, 200, 200);
// Use the helpful Attachment class structure to process the file for you
const attachment = new MessageAttachment(canvas.toBuffer(), 'profile-image.png');
message.channel.send({
files: [attachment],
});
}
module.exports.help = {
name: "stats"
}