This repository has been archived by the owner on Sep 13, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Unstream
committed
Apr 14, 2024
1 parent
e087654
commit 1306da2
Showing
18 changed files
with
1,778 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
node_modules/ | ||
.DS_Store |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<div align='center'> | ||
<img src='https://raw.githubusercontent.com/enmity-mod/assets/main/Enmity_Banner.png?raw=true' /> | ||
</div> | ||
|
||
--- | ||
|
||
<div align='center'> | ||
<h3>Plugin Template</h3> | ||
|
||
Template for Enmity plugins.<br /> | ||
Use `npm install` to install the required modules and use `npm run build` to build your plugin. | ||
</div> | ||
|
||
--- | ||
|
||
<div align='center' style='margin-top: 15px;'> | ||
<a href='https://discord.gg/rMdzhWUaGT'><img align='center' alt='Discord' src='https://img.shields.io/discord/950850315601711176?color=36309d&label=DISCORD&logo=discord&logoColor=white&style=for-the-badge'></a> | ||
<a href='https://twitter.com/EnmityApp'><img align='center' alt='Twitter' src='https://img.shields.io/twitter/follow/EnmityApp?color=36309d&label=TWITTER&logo=TWITTER&logoColor=white&style=for-the-badge'></a> | ||
</div> |
Binary file not shown.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{ | ||
"name": "HTTPCat", | ||
"version": "0.0.4", | ||
"description": "Figure out what a status code is with cats.", | ||
"authors": [ | ||
{ | ||
"name": "neinkatze", | ||
"id": "1125315673829154837" | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"ignore": [ | ||
"dist/*", | ||
"dist" | ||
], | ||
"exec": "npm run build", | ||
"ext": "*.*" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
{ | ||
"name": "plugin-template", | ||
"description": "Template for enmity plugins.", | ||
"version": "1.0.0", | ||
"license": "GPL-3.0", | ||
"author": "Zoey & eternal", | ||
"scripts": { | ||
"build": "rollup -c --configPlugin esbuild" | ||
}, | ||
"devDependencies": { | ||
"@rollup/plugin-commonjs": "^21.0.1", | ||
"@rollup/plugin-json": "^4.1.0", | ||
"@rollup/plugin-node-resolve": "^13.1.1", | ||
"@types/node": "^17.0.5", | ||
"@typescript-eslint/eslint-plugin": "^5.8.1", | ||
"@typescript-eslint/parser": "^5.8.1", | ||
"esbuild": "^0.14.9", | ||
"eslint": "^8.5.0", | ||
"rollup": "^2.62.0", | ||
"rollup-plugin-esbuild": "^4.8.2" | ||
}, | ||
"optionalDependencies": { | ||
"esbuild-darwin-64": "^0.14.21", | ||
"esbuild-darwin-arm64": "^0.14.21", | ||
"esbuild-linux-64": "^0.14.21", | ||
"esbuild-windows-64": "^0.14.21" | ||
}, | ||
"dependencies": { | ||
"enmity": "*" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import { nodeResolve } from '@rollup/plugin-node-resolve'; | ||
import commonjs from '@rollup/plugin-commonjs'; | ||
import esbuild from 'rollup-plugin-esbuild'; | ||
import json from '@rollup/plugin-json'; | ||
|
||
import manifest from './manifest.json'; | ||
import { defineConfig } from 'rollup'; | ||
|
||
export default defineConfig({ | ||
input: 'src/index.tsx', | ||
output: [ | ||
{ | ||
file: `dist/${manifest.name}.js`, | ||
format: 'cjs', | ||
strict: false | ||
}, | ||
], | ||
plugins: [ | ||
nodeResolve(), | ||
commonjs(), | ||
json(), | ||
esbuild({ minify: true, target: 'ES2019' }) | ||
] | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,193 @@ | ||
import { Plugin, registerPlugin } from "enmity/managers/plugins"; | ||
import { | ||
ApplicationCommandInputType, | ||
ApplicationCommandOptionType, | ||
ApplicationCommandType, | ||
Command, | ||
} from "enmity/api/commands"; | ||
import { Image } from "enmity/components"; | ||
import { create } from "enmity/patcher"; | ||
import manifest from "../manifest.json"; | ||
import { sendReply } from "enmity/api/clyde"; | ||
|
||
const status_code = [ | ||
"100", | ||
"101", | ||
"102", | ||
"103", | ||
"200", | ||
"201", | ||
"202", | ||
"203", | ||
"204", | ||
"205", | ||
"206", | ||
"207", | ||
"208", | ||
"214", | ||
"226", | ||
"300", | ||
"301", | ||
"302", | ||
"303", | ||
"304", | ||
"305", | ||
"307", | ||
"308", | ||
"400", | ||
"401", | ||
"402", | ||
"403", | ||
"404", | ||
"405", | ||
"406", | ||
"407", | ||
"408", | ||
"409", | ||
"410", | ||
"411", | ||
"412", | ||
"413", | ||
"414", | ||
"415", | ||
"416", | ||
"417", | ||
"418", | ||
"420", | ||
"421", | ||
"422", | ||
"423", | ||
"424", | ||
"425", | ||
"426", | ||
"428", | ||
"429", | ||
"431", | ||
"444", | ||
"450", | ||
"451", | ||
"497", | ||
"498", | ||
"499", | ||
"500", | ||
"501", | ||
"502", | ||
"503", | ||
"504", | ||
"506", | ||
"507", | ||
"508", | ||
"509", | ||
"510", | ||
"511", | ||
"521", | ||
"522", | ||
"523", | ||
"525", | ||
"530", | ||
"599", | ||
]; | ||
|
||
const Patcher = create("HTTPCatPlugin"); | ||
const HTTPCatPlugin: Plugin = { | ||
...manifest, | ||
name: "HTTPCat", | ||
commands: [], | ||
|
||
onStart() { | ||
const command: Command = { | ||
id: "HTTPCat-command", | ||
|
||
name: "cat", | ||
displayName: "cat", | ||
|
||
description: "Sends the cat image for an http status code.", | ||
displayDescription: "Sends the cat image for an http status code.", | ||
|
||
type: ApplicationCommandType.Chat, | ||
inputType: ApplicationCommandInputType.BuiltInText, | ||
|
||
options: [ | ||
{ | ||
name: "code", | ||
displayName: "code", | ||
|
||
description: "HTTP Status Code", | ||
displayDescription: "HTTP Status Code", | ||
|
||
type: ApplicationCommandOptionType.String, | ||
required: true, | ||
choices: status_code.map((x) => ({ | ||
name: x, | ||
displayName: x, | ||
value: x, | ||
})), | ||
}, | ||
{ | ||
name: "quiet", | ||
displayName: "quiet", | ||
|
||
description: "Quietly send the image so only yourself can see it.", | ||
displayDescription: | ||
"Quietly send the image so only yourself can see it.", | ||
|
||
type: ApplicationCommandOptionType.Boolean, | ||
required: false, | ||
}, | ||
], | ||
|
||
execute: async function (args, message) { | ||
const statusCode = args[0].value; | ||
const url = `https://http.cat/${statusCode}`; | ||
if (args[1]?.value ?? true) { | ||
const embed = { | ||
type: "rich", | ||
title: `HTTP ${statusCode} Cat Image`, | ||
image: { | ||
proxy_url: `https://external-content.duckduckgo.com/iu/?u=${url}`, | ||
url: url, | ||
width: 750, | ||
height: 600, | ||
}, | ||
footer: { | ||
text: "http.cat", | ||
}, | ||
}; | ||
const component = { | ||
type: 1, | ||
components: [ | ||
{ | ||
type: 2, | ||
style: 5, | ||
label: "View image", | ||
url: url, | ||
}, | ||
], | ||
}; | ||
sendReply( | ||
message?.channel.id ?? "0", | ||
{ | ||
embeds: [embed], | ||
components: [component], | ||
}, | ||
"HTTP Cats", | ||
"https://github.com/httpcats.png" | ||
); | ||
} else { | ||
return { | ||
content: url, | ||
}; | ||
} | ||
}, | ||
}; | ||
|
||
this.commands.push(command); | ||
}, | ||
|
||
onStop() { | ||
Patcher.unpatchAll(); | ||
this.commands = []; | ||
}, | ||
}; | ||
|
||
registerPlugin(HTTPCatPlugin); |
Oops, something went wrong.