mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-16 15:57:54 +02:00
has-transparency Command
This commit is contained in:
@@ -119,7 +119,7 @@ don't grant that permission.
|
|||||||
|
|
||||||
## Commands
|
## Commands
|
||||||
|
|
||||||
Total: 374
|
Total: 375
|
||||||
|
|
||||||
### Utility:
|
### Utility:
|
||||||
|
|
||||||
@@ -336,6 +336,7 @@ Total: 374
|
|||||||
* **chinese-zodiac:** Responds with the Chinese Zodiac Sign for the given year.
|
* **chinese-zodiac:** Responds with the Chinese Zodiac Sign for the given year.
|
||||||
* **face:** Determines the race, gender, and age of a face.
|
* **face:** Determines the race, gender, and age of a face.
|
||||||
* **gender:** Determines the gender of a name.
|
* **gender:** Determines the gender of a name.
|
||||||
|
* **has-transparency:** Determines if an image has transparency in it.
|
||||||
* **read-qr-code:** Reads a QR Code.
|
* **read-qr-code:** Reads a QR Code.
|
||||||
* **scrabble-score:** Responds with the scrabble score of a word.
|
* **scrabble-score:** Responds with the scrabble score of a word.
|
||||||
* **severe-toxicity:** Determines the toxicity of text, but less sensitive to milder language.
|
* **severe-toxicity:** Determines the toxicity of text, but less sensitive to milder language.
|
||||||
|
|||||||
@@ -0,0 +1,38 @@
|
|||||||
|
const Command = require('../../structures/Command');
|
||||||
|
const { loadImage } = require('canvas');
|
||||||
|
const request = require('node-superfetch');
|
||||||
|
const { hasAlpha } = require('../../util/Canvas');
|
||||||
|
|
||||||
|
module.exports = class HasTransparencyCommand extends Command {
|
||||||
|
constructor(client) {
|
||||||
|
super(client, {
|
||||||
|
name: 'has-transparency',
|
||||||
|
aliases: ['has-alpha', 'transparency', 'transparent', 'alpha'],
|
||||||
|
group: 'meme-gen',
|
||||||
|
memberName: 'has-transparency',
|
||||||
|
description: 'Determines if an image has transparency in it.',
|
||||||
|
throttling: {
|
||||||
|
usages: 1,
|
||||||
|
duration: 10
|
||||||
|
},
|
||||||
|
args: [
|
||||||
|
{
|
||||||
|
key: 'image',
|
||||||
|
prompt: 'What image would you like to test?',
|
||||||
|
type: 'image',
|
||||||
|
default: msg => msg.author.displayAvatarURL({ format: 'png', size: 512 })
|
||||||
|
}
|
||||||
|
]
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async run(msg, { image }) {
|
||||||
|
try {
|
||||||
|
const { body } = await request.get(image);
|
||||||
|
const data = await loadImage(body);
|
||||||
|
return msg.say(`This image **${hasAlpha(data) ? 'has' : 'does not have'}** transparency.`);
|
||||||
|
} catch (err) {
|
||||||
|
return msg.reply(`Oh no, an error occurred: \`${err.message}\`. Try again later!`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "xiao",
|
"name": "xiao",
|
||||||
"version": "112.13.3",
|
"version": "112.14.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