mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-22 18:29:14 +02:00
Chinese Restaurant Command
This commit is contained in:
@@ -224,7 +224,7 @@ in the appropriate channel's topic to use it.
|
|||||||
|
|
||||||
## Commands
|
## Commands
|
||||||
|
|
||||||
Total: 432
|
Total: 433
|
||||||
|
|
||||||
### Utility:
|
### Utility:
|
||||||
|
|
||||||
@@ -519,6 +519,7 @@ Total: 432
|
|||||||
* **axis-cult-sign-up:** Sends an Axis Cult Sign-Up sheet for you. Join today!
|
* **axis-cult-sign-up:** Sends an Axis Cult Sign-Up sheet for you. Join today!
|
||||||
* **brazzers:** Draws an image with the Brazzers logo in the corner. (NSFW)
|
* **brazzers:** Draws an image with the Brazzers logo in the corner. (NSFW)
|
||||||
* **certificate:** Sends a certificate of excellence with the name and reason of your choice.
|
* **certificate:** Sends a certificate of excellence with the name and reason of your choice.
|
||||||
|
* **chinese-restaurant:** Sends a Chinese restaurant sign with the text of your choice.
|
||||||
* **circle:** Draws an image or a user's avatar as a circle.
|
* **circle:** Draws an image or a user's avatar as a circle.
|
||||||
* **color:** Sends an image of the color you choose.
|
* **color:** Sends an image of the color you choose.
|
||||||
* **contrast:** Draws an image or a user's avatar but with contrast.
|
* **contrast:** Draws an image or a user's avatar but with contrast.
|
||||||
@@ -791,6 +792,8 @@ here.
|
|||||||
* itunes ([iTunes Search API](https://affiliate.itunes.apple.com/resources/documentation/itunes-store-web-service-search-api/))
|
* itunes ([iTunes Search API](https://affiliate.itunes.apple.com/resources/documentation/itunes-store-web-service-search-api/))
|
||||||
- [astrology.TV](https://astrology.tv/)
|
- [astrology.TV](https://astrology.tv/)
|
||||||
* horoscope ([Horoscope Data](https://astrology.tv/horoscope/daily/))
|
* horoscope ([Horoscope Data](https://astrology.tv/horoscope/daily/))
|
||||||
|
- [ATOM.SMASHER.ORG](http://atom.smasher.org/)
|
||||||
|
* chinese-restaurant ([Image](http://atom.smasher.org/chinese/))
|
||||||
- [Attype Studio](https://www.dafont.com/fadli-ramadhan-iskandar.d7339)
|
- [Attype Studio](https://www.dafont.com/fadli-ramadhan-iskandar.d7339)
|
||||||
* friendship ([Pinky Cupid Font](https://www.dafont.com/pinky-cupid.font))
|
* friendship ([Pinky Cupid Font](https://www.dafont.com/pinky-cupid.font))
|
||||||
* ship ([Pinky Cupid Font](https://www.dafont.com/pinky-cupid.font))
|
* ship ([Pinky Cupid Font](https://www.dafont.com/pinky-cupid.font))
|
||||||
@@ -891,6 +894,7 @@ here.
|
|||||||
- [FML](https://www.fmylife.com/)
|
- [FML](https://www.fmylife.com/)
|
||||||
* fml (FML Data)
|
* fml (FML Data)
|
||||||
- [Fontsgeek](http://fontsgeek.com/)
|
- [Fontsgeek](http://fontsgeek.com/)
|
||||||
|
* chinese-restaurant ([Futura Condensed Font](http://fontsgeek.com/fonts/Futura-Condensed-Bold))
|
||||||
* skyrim-skill ([Futura Condensed Font](http://fontsgeek.com/fonts/Futura-Condensed-Regular))
|
* skyrim-skill ([Futura Condensed Font](http://fontsgeek.com/fonts/Futura-Condensed-Regular))
|
||||||
- [Foreign exchange rates API](https://exchangeratesapi.io/)
|
- [Foreign exchange rates API](https://exchangeratesapi.io/)
|
||||||
* currency (API)
|
* currency (API)
|
||||||
|
|||||||
Binary file not shown.
|
After Width: | Height: | Size: 528 KiB |
@@ -0,0 +1,74 @@
|
|||||||
|
const Command = require('../../structures/Command');
|
||||||
|
const { createCanvas, loadImage, registerFont } = require('canvas');
|
||||||
|
const path = require('path');
|
||||||
|
const { wrapText } = require('../../util/Canvas');
|
||||||
|
registerFont(path.join(__dirname, '..', '..', 'assets', 'fonts', 'Futura Condensed.ttf'), {
|
||||||
|
family: 'Futura',
|
||||||
|
weight: 'bold'
|
||||||
|
});
|
||||||
|
|
||||||
|
module.exports = class ChineseRestaurantCommand extends Command {
|
||||||
|
constructor(client) {
|
||||||
|
super(client, {
|
||||||
|
name: 'chinese-restaurant',
|
||||||
|
aliases: ['chinese-restaurant-sign', 'chinese-food-sign', 'chinese-sign'],
|
||||||
|
group: 'edit-image',
|
||||||
|
memberName: 'chinese-restaurant',
|
||||||
|
description: 'Sends a Chinese restaurant sign with the text of your choice.',
|
||||||
|
throttling: {
|
||||||
|
usages: 1,
|
||||||
|
duration: 10
|
||||||
|
},
|
||||||
|
clientPermissions: ['ATTACH_FILES'],
|
||||||
|
credit: [
|
||||||
|
{
|
||||||
|
name: 'ATOM.SMASHER.ORG',
|
||||||
|
url: 'http://atom.smasher.org/',
|
||||||
|
reason: 'Image',
|
||||||
|
reasonURL: 'http://atom.smasher.org/chinese/'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'Fontsgeek',
|
||||||
|
url: 'http://fontsgeek.com/',
|
||||||
|
reason: 'Futura Condensed Font',
|
||||||
|
reasonURL: 'http://fontsgeek.com/fonts/Futura-Condensed-Bold'
|
||||||
|
}
|
||||||
|
],
|
||||||
|
args: [
|
||||||
|
{
|
||||||
|
key: 'text',
|
||||||
|
prompt: 'What should the text of the sign be?',
|
||||||
|
type: 'string'
|
||||||
|
}
|
||||||
|
]
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async run(msg, { text }) {
|
||||||
|
const base = await loadImage(path.join(__dirname, '..', '..', 'assets', 'images', 'chinese-restaurant.png'));
|
||||||
|
const canvas = createCanvas(base.width, base.height);
|
||||||
|
const ctx = canvas.getContext('2d');
|
||||||
|
ctx.drawImage(base, 0, 0);
|
||||||
|
ctx.fillStyle = 'black';
|
||||||
|
ctx.textAlign = 'center';
|
||||||
|
ctx.textBaseline = 'top';
|
||||||
|
ctx.font = 'normal bold 28px Futura';
|
||||||
|
const lines = await wrapText(ctx, text.toUpperCase(), 340);
|
||||||
|
if (lines.length === 1) {
|
||||||
|
ctx.fillText(lines[0], base.width / 2, 294);
|
||||||
|
} else if (lines.length === 2) {
|
||||||
|
ctx.fillText(lines[0], base.width / 2, 294);
|
||||||
|
ctx.fillText(lines[1], base.width / 2, 323);
|
||||||
|
} else if (lines.length === 3) {
|
||||||
|
ctx.fillText(lines[0], base.width / 2, 269);
|
||||||
|
ctx.fillText(lines[1], base.width / 2, 294);
|
||||||
|
ctx.fillText(lines[2], base.width / 2, 323);
|
||||||
|
} else {
|
||||||
|
ctx.fillText(lines[0], base.width / 2, 269);
|
||||||
|
ctx.fillText(lines[1], base.width / 2, 294);
|
||||||
|
ctx.fillText(lines[2], base.width / 2, 323);
|
||||||
|
ctx.fillText(lines[4], base.width / 2, 350);
|
||||||
|
}
|
||||||
|
return msg.say({ files: [{ attachment: canvas.toBuffer(), name: 'chinese-restaurant.png' }] });
|
||||||
|
}
|
||||||
|
};
|
||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "xiao",
|
"name": "xiao",
|
||||||
"version": "114.20.0",
|
"version": "114.21.0",
|
||||||
"description": "Your personal server companion.",
|
"description": "Your personal server companion.",
|
||||||
"main": "Xiao.js",
|
"main": "Xiao.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|||||||
Reference in New Issue
Block a user