mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-03 23:36:43 +02:00
Skyrim Skill Command
This commit is contained in:
@@ -132,7 +132,7 @@ in the appropriate channel's topic to use it.
|
||||
|
||||
## Commands
|
||||
|
||||
Total: 408
|
||||
Total: 409
|
||||
|
||||
### Utility:
|
||||
|
||||
@@ -494,6 +494,7 @@ Total: 408
|
||||
* **new-password:** Sends a "Weak Password/Strong Password" meme with the passwords of your choice.
|
||||
* **nike-ad:** Sends a "Believe in Something" Nike Ad meme with the text of your choice.
|
||||
* **plankton-plan:** Sends a Plankton's Plan meme with steps of your choice.
|
||||
* **skyrim-skill:** Sends a "Skyrim Skill" meme with the skill and image of your choice.
|
||||
* **sora-selfie:** Draws an image or a user's avatar behind Sora taking a selfie.
|
||||
* **sos:** Sends a "Esther Verkest's Help Sign" comic with the text of your choice.
|
||||
* **spongebob-burn:** Sends a "Spongebob Throwing Something into a Fire" meme with words of your choice.
|
||||
@@ -673,6 +674,8 @@ here.
|
||||
* axis-cult (Prayer Data)
|
||||
- [AZLyrics](https://www.azlyrics.com/)
|
||||
* lyrics (Lyrics Data)
|
||||
- [Bethesda](https://bethesda.net/en/dashboard)
|
||||
* skyrim-skill ([Image, Original "The Elder Scrolls V: Skyrim" Game](https://elderscrolls.bethesda.net/en/skyrim))
|
||||
- [Bob Ross](https://www.bobross.com/)
|
||||
* bob-ross (Himself)
|
||||
- [Bowserinator](https://github.com/Bowserinator/)
|
||||
@@ -757,6 +760,8 @@ here.
|
||||
* flickr ([API](https://www.flickr.com/services/api/))
|
||||
- [FML](https://www.fmylife.com/)
|
||||
* fml (FML Data)
|
||||
- [Fontsgeek](http://fontsgeek.com/)
|
||||
* skyrim-skill ([Futura Condensed Font](http://fontsgeek.com/fonts/Futura-Condensed-Regular))
|
||||
- [Foreign exchange rates API](https://exchangeratesapi.io/)
|
||||
* currency (API)
|
||||
- [Free SVG](https://freesvg.org/)
|
||||
|
||||
Binary file not shown.
Binary file not shown.
|
After Width: | Height: | Size: 64 KiB |
@@ -0,0 +1,78 @@
|
||||
const Command = require('../../structures/Command');
|
||||
const { createCanvas, loadImage, registerFont } = require('canvas');
|
||||
const request = require('node-superfetch');
|
||||
const path = require('path');
|
||||
registerFont(path.join(__dirname, '..', '..', 'assets', 'fonts', 'Futura Condensed.ttf'), { family: 'Futura' });
|
||||
|
||||
module.exports = class SkyrimSkillCommand extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'skyrim-skill',
|
||||
aliases: ['skyrim-level', 'skyrim'],
|
||||
group: 'edit-meme',
|
||||
memberName: 'skyrim-skill',
|
||||
description: 'Sends a "Skyrim Skill" meme with the skill and image of your choice.',
|
||||
throttling: {
|
||||
usages: 1,
|
||||
duration: 10
|
||||
},
|
||||
clientPermissions: ['ATTACH_FILES'],
|
||||
credit: [
|
||||
{
|
||||
name: 'Bethesda',
|
||||
url: 'https://bethesda.net/en/dashboard',
|
||||
reason: 'Image, Original "The Elder Scrolls V: Skyrim" Game',
|
||||
reasonURL: 'https://elderscrolls.bethesda.net/en/skyrim'
|
||||
},
|
||||
{
|
||||
name: 'Fontsgeek',
|
||||
url: 'http://fontsgeek.com/',
|
||||
reason: 'Futura Condensed Font',
|
||||
reasonURL: 'http://fontsgeek.com/fonts/Futura-Condensed-Regular'
|
||||
}
|
||||
],
|
||||
args: [
|
||||
{
|
||||
key: 'skill',
|
||||
prompt: 'What skill should be used?',
|
||||
type: 'string',
|
||||
max: 10,
|
||||
parse: skill => skill.toUpperCase()
|
||||
},
|
||||
{
|
||||
key: 'image',
|
||||
prompt: 'What image would you like to edit?',
|
||||
type: 'image',
|
||||
default: msg => msg.author.displayAvatarURL({ format: 'png', size: 2048 })
|
||||
}
|
||||
]
|
||||
});
|
||||
}
|
||||
|
||||
async run(msg, { skill, image }) {
|
||||
try {
|
||||
const { body } = await request.get(image);
|
||||
const base = await loadImage(body);
|
||||
const plate = await loadImage(path.join(__dirname, '..', '..', 'assets', 'images', 'skyrim-skill.png'));
|
||||
const ratio = base.width / base.height;
|
||||
const height = Math.round(plate.width / ratio);
|
||||
const canvas = createCanvas(base.width, base.height + height);
|
||||
const ctx = canvas.getContext('2d');
|
||||
ctx.drawImage(base, 0, 0);
|
||||
const fontSize = Math.round(77 / ratio);
|
||||
ctx.font = `normal bold ${fontSize}px Futura`;
|
||||
ctx.fillStyle = 'white';
|
||||
ctx.textAlign = 'center';
|
||||
ctx.textBaseline = 'top';
|
||||
ctx.strokeStyle = 'black';
|
||||
ctx.lineWidth = 10;
|
||||
ctx.strokeText(skill, 189, base.height + 84);
|
||||
ctx.fillText(skill, 189, base.height + 84);
|
||||
const attachment = canvas.toBuffer();
|
||||
if (Buffer.byteLength(attachment) > 8e+6) return msg.reply('Resulting image was above 8 MB.');
|
||||
return msg.say({ files: [{ attachment, name: 'skyrim-skill.png' }] });
|
||||
} catch (err) {
|
||||
return msg.reply(`Oh no, an error occurred: \`${err.message}\`. Try again later!`);
|
||||
}
|
||||
}
|
||||
};
|
||||
+2
-2
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "xiao",
|
||||
"version": "114.1.2",
|
||||
"version": "114.2.0",
|
||||
"description": "Your personal server companion.",
|
||||
"main": "Xiao.js",
|
||||
"scripts": {
|
||||
@@ -44,7 +44,7 @@
|
||||
"dotenv": "^8.2.0",
|
||||
"gifencoder": "^2.0.1",
|
||||
"mathjs": "^6.6.4",
|
||||
"moment": "^2.25.1",
|
||||
"moment": "^2.25.3",
|
||||
"moment-duration-format": "^2.3.2",
|
||||
"moment-timezone": "^0.5.28",
|
||||
"node-superfetch": "^0.1.10",
|
||||
|
||||
Reference in New Issue
Block a user