.
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 |
2 |

3 |
4 |
5 | ---
6 |
7 |
8 |
Plugin Template
9 |
10 | Template for Enmity plugins.
11 | Use `npm install` to install the required modules and use `npm run build` to build your plugin.
12 |
13 |
14 | ---
15 |
16 |
17 |

18 |

19 |
20 |
--------------------------------------------------------------------------------
/manifest.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "SilentTyping",
3 | "version": "1.0.0",
4 | "description": "Silences your typing indicator.",
5 | "authors": [
6 | {
7 | "name": "eternal",
8 | "id": "263689920210534400"
9 | }
10 | ]
11 | }
--------------------------------------------------------------------------------
/nodemon.json:
--------------------------------------------------------------------------------
1 | {
2 | "ignore": [
3 | "dist/*",
4 | "dist"
5 | ],
6 | "exec": "npm run build",
7 | "ext": "*.*"
8 | }
9 |
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "plugin-template",
3 | "description": "Template for enmity plugins.",
4 | "version": "1.0.0",
5 | "license": "GPL-3.0",
6 | "author": "Zoey & eternal",
7 | "scripts": {
8 | "build": "rollup -c --configPlugin esbuild"
9 | },
10 | "devDependencies": {
11 | "@rollup/plugin-commonjs": "^21.0.1",
12 | "@rollup/plugin-json": "^4.1.0",
13 | "@rollup/plugin-node-resolve": "^13.1.1",
14 | "@types/node": "^17.0.5",
15 | "@typescript-eslint/eslint-plugin": "^5.8.1",
16 | "@typescript-eslint/parser": "^5.8.1",
17 | "esbuild": "^0.14.9",
18 | "eslint": "^8.5.0",
19 | "rollup": "^2.62.0",
20 | "rollup-plugin-esbuild": "^4.8.2"
21 | },
22 | "optionalDependencies": {
23 | "esbuild-darwin-64": "^0.14.21",
24 | "esbuild-darwin-arm64": "^0.14.21",
25 | "esbuild-linux-64": "^0.14.21",
26 | "esbuild-windows-64": "^0.14.21"
27 | },
28 | "dependencies": {
29 | "enmity": "*"
30 | }
31 | }
--------------------------------------------------------------------------------
/rollup.config.ts:
--------------------------------------------------------------------------------
1 | import { nodeResolve } from '@rollup/plugin-node-resolve';
2 | import commonjs from '@rollup/plugin-commonjs';
3 | import esbuild from 'rollup-plugin-esbuild';
4 | import json from '@rollup/plugin-json';
5 |
6 | import manifest from './manifest.json';
7 | import { defineConfig } from 'rollup';
8 |
9 | export default defineConfig({
10 | input: 'src/index.tsx',
11 | output: [
12 | {
13 | file: `dist/${manifest.name}.js`,
14 | format: 'cjs',
15 | strict: false
16 | },
17 | ],
18 | plugins: [
19 | nodeResolve(),
20 | commonjs(),
21 | json(),
22 | esbuild({ minify: true, target: 'ES2019' })
23 | ]
24 | });
--------------------------------------------------------------------------------
/src/components/Settings.tsx:
--------------------------------------------------------------------------------
1 | import { FormRow, FormSwitch } from 'enmity/components';
2 | import { SettingsStore } from 'enmity/api/settings';
3 | import { React } from 'enmity/metro/common';
4 |
5 | interface SettingsProps {
6 | settings: SettingsStore;
7 | }
8 |
9 | export default ({ settings }: SettingsProps) => {
10 | return settings.toggle('example', true)}
16 | />
17 | }
18 | />;
19 | };
--------------------------------------------------------------------------------
/src/index.tsx:
--------------------------------------------------------------------------------
1 | import { Plugin, registerPlugin } from 'enmity/managers/plugins';
2 | import { React } from 'enmity/metro/common';
3 | import { getByProps } from 'enmity/metro';
4 | import { create } from 'enmity/patcher';
5 | import manifest from '../manifest.json';
6 |
7 | import Settings from './components/Settings';
8 |
9 | const Typing = getByProps('startTyping');
10 | const Patcher = create('silent-typing');
11 |
12 | const SilentTyping: Plugin = {
13 | ...manifest,
14 |
15 | onStart() {
16 | Patcher.instead(Typing, 'startTyping', () => { });
17 | Patcher.instead(Typing, 'stopTyping', () => { });
18 | },
19 |
20 | onStop() {
21 | Patcher.unpatchAll();
22 | },
23 |
24 | getSettingsPanel({ settings }) {
25 | return ;
26 | }
27 | };
28 |
29 | registerPlugin(SilentTyping);
30 |
--------------------------------------------------------------------------------