mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-22 18:29:14 +02:00
Screenshot Command
This commit is contained in:
@@ -227,7 +227,7 @@ in the appropriate channel's topic to use it.
|
|||||||
|
|
||||||
## Commands
|
## Commands
|
||||||
|
|
||||||
Total: 497
|
Total: 498
|
||||||
|
|
||||||
### Utility:
|
### Utility:
|
||||||
|
|
||||||
@@ -764,6 +764,7 @@ Total: 497
|
|||||||
* **portal-send:** Send a message to a portal channel.
|
* **portal-send:** Send a message to a portal channel.
|
||||||
* **prune:** Deletes up to 99 messages from the current channel.
|
* **prune:** Deletes up to 99 messages from the current channel.
|
||||||
* **rename-all:** Renames every member of the server. (Owner-Only)
|
* **rename-all:** Renames every member of the server. (Owner-Only)
|
||||||
|
* **screenshot:** Takes a screenshot of any webpage.
|
||||||
* **smilebasic:** Responds with a ZIP file for a SmileBASIC project.
|
* **smilebasic:** Responds with a ZIP file for a SmileBASIC project.
|
||||||
* **strawpoll:** Generates a Strawpoll with the options you provide.
|
* **strawpoll:** Generates a Strawpoll with the options you provide.
|
||||||
|
|
||||||
@@ -876,6 +877,8 @@ here.
|
|||||||
* axis-cult (Prayer Data)
|
* axis-cult (Prayer Data)
|
||||||
- [AZLyrics](https://www.azlyrics.com/)
|
- [AZLyrics](https://www.azlyrics.com/)
|
||||||
* lyrics (Lyrics Data)
|
* lyrics (Lyrics Data)
|
||||||
|
- [AzuraApple](https://github.com/AzuraApple)
|
||||||
|
* screenshot (Concept)
|
||||||
- [Bethesda](https://bethesda.net/en/dashboard)
|
- [Bethesda](https://bethesda.net/en/dashboard)
|
||||||
* dislike ([Image, Original "Fallout" Game](https://fallout.bethesda.net/en/))
|
* dislike ([Image, Original "Fallout" Game](https://fallout.bethesda.net/en/))
|
||||||
* like ([Image, Original "Fallout" Game](https://fallout.bethesda.net/en/))
|
* like ([Image, Original "Fallout" Game](https://fallout.bethesda.net/en/))
|
||||||
@@ -1498,6 +1501,8 @@ here.
|
|||||||
* ai-vase (API)
|
* ai-vase (API)
|
||||||
- [This Waifu Does Not Exist](https://www.thiswaifudoesnotexist.net/)
|
- [This Waifu Does Not Exist](https://www.thiswaifudoesnotexist.net/)
|
||||||
* ai-waifu (API)
|
* ai-waifu (API)
|
||||||
|
- [Thum.io](https://www.thum.io/)
|
||||||
|
* screenshot (API)
|
||||||
- [Tim's Printables](https://www.timvandevall.com/)
|
- [Tim's Printables](https://www.timvandevall.com/)
|
||||||
* wanted ([Image](https://www.pinterest.com/pin/365002744774849370/))
|
* wanted ([Image](https://www.pinterest.com/pin/365002744774849370/))
|
||||||
- [TrueAchievements](https://www.trueachievements.com/)
|
- [TrueAchievements](https://www.trueachievements.com/)
|
||||||
|
|||||||
@@ -0,0 +1,45 @@
|
|||||||
|
const Command = require('../../structures/Command');
|
||||||
|
const request = require('node-superfetch');
|
||||||
|
|
||||||
|
module.exports = class ScreenshotCommand extends Command {
|
||||||
|
constructor(client) {
|
||||||
|
super(client, {
|
||||||
|
name: 'screenshot',
|
||||||
|
aliases: ['capture', 'ss'],
|
||||||
|
group: 'other',
|
||||||
|
memberName: 'screenshot',
|
||||||
|
description: 'Takes a screenshot of any webpage.',
|
||||||
|
clientPermissions: ['ATTACH_FILES'],
|
||||||
|
credit: [
|
||||||
|
{
|
||||||
|
name: 'Thum.io',
|
||||||
|
url: 'https://www.thum.io/',
|
||||||
|
reason: 'API'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'AzuraApple',
|
||||||
|
url: 'https://github.com/AzuraApple',
|
||||||
|
reason: 'Concept'
|
||||||
|
}
|
||||||
|
],
|
||||||
|
args: [
|
||||||
|
{
|
||||||
|
key: 'url',
|
||||||
|
prompt: 'What webpage do you want to take a screenshot of?',
|
||||||
|
type: 'string',
|
||||||
|
parse: url => encodeURIComponent(url)
|
||||||
|
}
|
||||||
|
]
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async run(msg, { url }) {
|
||||||
|
try {
|
||||||
|
const { body } = await request.get(`https://image.thum.io/get/width/1920/crop/675/noanimate/${url}`);
|
||||||
|
return msg.say({ files: [{ attachment: body, name: 'screenshot.png' }] });
|
||||||
|
} catch (err) {
|
||||||
|
if (err.status === 404) return msg.say('Could not find any results. Invalid URL?');
|
||||||
|
return msg.reply(`Oh no, an error occurred: \`${err.message}\`. Try again later!`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "xiao",
|
"name": "xiao",
|
||||||
"version": "116.35.0",
|
"version": "116.36.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