Better authors field (#18)
This commit is contained in:
		
							parent
							
								
									3e64054283
								
							
						
					
					
						commit
						ef353f1d66
					
				
					 22 changed files with 71 additions and 26 deletions
				
			
		|  | @ -7,7 +7,7 @@ import { startAllPlugins } from "./plugins"; | ||||||
| 
 | 
 | ||||||
| export { Settings }; | export { Settings }; | ||||||
| 
 | 
 | ||||||
| import "./utils/patchWebpack"; | import "./webpack/patchWebpack"; | ||||||
| import "./utils/quickCss"; | import "./utils/quickCss"; | ||||||
| import { checkForUpdates, UpdateLogger } from './utils/updater'; | import { checkForUpdates, UpdateLogger } from './utils/updater'; | ||||||
| import { onceReady } from "./webpack"; | import { onceReady } from "./webpack"; | ||||||
|  |  | ||||||
|  | @ -1,9 +1,10 @@ | ||||||
| import definePlugin from "../utils/types"; | import definePlugin from "../utils/types"; | ||||||
|  | import { Devs } from '../utils/constants'; | ||||||
| 
 | 
 | ||||||
| export default definePlugin({ | export default definePlugin({ | ||||||
|     name: "STFU", |     name: "STFU", | ||||||
|     description: "Disables the 'HOLD UP' banner in the console", |     description: "Disables the 'HOLD UP' banner in the console", | ||||||
|     author: "Vendicated", |     authors: [Devs.Ven], | ||||||
|     patches: [{ |     patches: [{ | ||||||
|         find: "setDevtoolsCallbacks", |         find: "setDevtoolsCallbacks", | ||||||
|         replacement: { |         replacement: { | ||||||
|  |  | ||||||
|  | @ -1,9 +1,10 @@ | ||||||
|  | import { Devs } from "../utils/constants"; | ||||||
| import definePlugin from "../utils/types"; | import definePlugin from "../utils/types"; | ||||||
| 
 | 
 | ||||||
| export default definePlugin({ | export default definePlugin({ | ||||||
|     name: "MessageEventsAPI", |     name: "MessageEventsAPI", | ||||||
|     description: "Api required by anything using message events.", |     description: "Api required by anything using message events.", | ||||||
|     author: "ArjixWasTaken", |     authors: [Devs.Arjix], | ||||||
|     patches: [ |     patches: [ | ||||||
|         { |         { | ||||||
|             find: "sendMessage:function", |             find: "sendMessage:function", | ||||||
|  |  | ||||||
|  | @ -1,9 +1,10 @@ | ||||||
|  | import { Devs } from "../utils/constants"; | ||||||
| import definePlugin from "../utils/types"; | import definePlugin from "../utils/types"; | ||||||
| 
 | 
 | ||||||
| export default definePlugin({ | export default definePlugin({ | ||||||
|     name: "ApiNotices", |     name: "ApiNotices", | ||||||
|     description: "Fixes notices being automatically dismissed", |     description: "Fixes notices being automatically dismissed", | ||||||
|     author: "Vendicated", |     authors: [Devs.Ven], | ||||||
|     required: true, |     required: true, | ||||||
|     patches: [ |     patches: [ | ||||||
|         { |         { | ||||||
|  |  | ||||||
|  | @ -3,7 +3,10 @@ import definePlugin from "../utils/types"; | ||||||
| export default definePlugin({ | export default definePlugin({ | ||||||
|     name: "BANger", |     name: "BANger", | ||||||
|     description: "Replaces the GIF in the ban dialogue with a custom one.", |     description: "Replaces the GIF in the ban dialogue with a custom one.", | ||||||
|     author: "Xinto", |     authors: [{ | ||||||
|  |         name: "Xinto", | ||||||
|  |         id: 423915768191647755n | ||||||
|  |     }], | ||||||
|     patches: [ |     patches: [ | ||||||
|         { |         { | ||||||
|             find: "BanConfirm", |             find: "BanConfirm", | ||||||
|  |  | ||||||
|  | @ -1,8 +1,9 @@ | ||||||
|  | import { Devs } from "../utils/constants"; | ||||||
| import definePlugin from "../utils/types"; | import definePlugin from "../utils/types"; | ||||||
| 
 | 
 | ||||||
| export default definePlugin({ | export default definePlugin({ | ||||||
|     name: "BetterGifAltText", |     name: "BetterGifAltText", | ||||||
|     author: "Vendicated", |     authors: [Devs.Ven], | ||||||
|     description: |     description: | ||||||
|         "Change GIF alt text from simply being 'GIF' to containing the gif tags / filename", |         "Change GIF alt text from simply being 'GIF' to containing the gif tags / filename", | ||||||
|     patches: [ |     patches: [ | ||||||
|  | @ -30,7 +31,7 @@ export default definePlugin({ | ||||||
|         let url: string = props.original || props.src; |         let url: string = props.original || props.src; | ||||||
|         try { |         try { | ||||||
|             url = decodeURI(url); |             url = decodeURI(url); | ||||||
|         } catch {} |         } catch { } | ||||||
| 
 | 
 | ||||||
|         let name = url |         let name = url | ||||||
|             .slice(url.lastIndexOf("/") + 1) |             .slice(url.lastIndexOf("/") + 1) | ||||||
|  |  | ||||||
|  | @ -1,9 +1,10 @@ | ||||||
|  | import { Devs } from "../utils/constants"; | ||||||
| import definePlugin from "../utils/types"; | import definePlugin from "../utils/types"; | ||||||
| import { Toasts } from '../webpack/common'; | import { Toasts } from '../webpack/common'; | ||||||
| 
 | 
 | ||||||
| export default definePlugin({ | export default definePlugin({ | ||||||
|     name: "ClickableRoleDot", |     name: "ClickableRoleDot", | ||||||
|     author: "Vendicated", |     authors: [Devs.Ven], | ||||||
|     description: |     description: | ||||||
|         "Makes RoleDots (Accessibility Feature) copy colour to clipboard on click", |         "Makes RoleDots (Accessibility Feature) copy colour to clipboard on click", | ||||||
|     patches: [ |     patches: [ | ||||||
|  |  | ||||||
|  | @ -1,8 +1,9 @@ | ||||||
|  | import { Devs } from "../utils/constants"; | ||||||
| import definePlugin from '../utils/types'; | import definePlugin from '../utils/types'; | ||||||
| 
 | 
 | ||||||
| export default definePlugin({ | export default definePlugin({ | ||||||
|     name: "Experiments", |     name: "Experiments", | ||||||
|     author: "Vendicated, Megumin", |     authors: [Devs.Ven, Devs.Megu], | ||||||
|     description: "Enable Experiments", |     description: "Enable Experiments", | ||||||
|     patches: [{ |     patches: [{ | ||||||
|         find: "Object.defineProperties(this,{isDeveloper", |         find: "Object.defineProperties(this,{isDeveloper", | ||||||
|  |  | ||||||
|  | @ -3,7 +3,10 @@ import definePlugin from "../utils/types"; | ||||||
| export default definePlugin({ | export default definePlugin({ | ||||||
|     name: "Folder SVG Icon", |     name: "Folder SVG Icon", | ||||||
|     description: "Doesn't show the small guild icons in folders", |     description: "Doesn't show the small guild icons in folders", | ||||||
|     author: "botato", |     authors: [{ | ||||||
|  |         name: "botato", | ||||||
|  |         id: 440990343899643943n | ||||||
|  |     }], | ||||||
|     patches: [{ |     patches: [{ | ||||||
|         find: "().expandedFolderIconWrapper", |         find: "().expandedFolderIconWrapper", | ||||||
|         replacement: [{ |         replacement: [{ | ||||||
|  |  | ||||||
|  | @ -1,9 +1,10 @@ | ||||||
|  | import { Devs } from "../utils/constants"; | ||||||
| import definePlugin from "../utils/types"; | import definePlugin from "../utils/types"; | ||||||
| 
 | 
 | ||||||
| export default definePlugin({ | export default definePlugin({ | ||||||
|     name: "Ify", |     name: "Ify", | ||||||
|     description: "Disabes Spotify auto-pausing and premium checks", |     description: "Disabes Spotify auto-pausing and premium checks", | ||||||
|     author: "Cynosphere", |     authors: [Devs.Cyn], | ||||||
|     patches: [ |     patches: [ | ||||||
|         { |         { | ||||||
|             find: '.displayName="SpotifyStore"', |             find: '.displayName="SpotifyStore"', | ||||||
|  |  | ||||||
|  | @ -1,4 +1,5 @@ | ||||||
| import { addClickListener, removeClickListener } from '../api/MessageEvents'; | import { addClickListener, removeClickListener } from '../api/MessageEvents'; | ||||||
|  | import { Devs } from "../utils/constants"; | ||||||
| import definePlugin from "../utils/types"; | import definePlugin from "../utils/types"; | ||||||
| import { find, findByProps } from "../webpack"; | import { find, findByProps } from "../webpack"; | ||||||
| import { UserStore } from "../webpack/common"; | import { UserStore } from "../webpack/common"; | ||||||
|  | @ -10,7 +11,7 @@ const keyup = (e: KeyboardEvent) => e.key === "Backspace" && (isDeletePressed = | ||||||
| export default definePlugin({ | export default definePlugin({ | ||||||
|     name: "MessageQuickActions", |     name: "MessageQuickActions", | ||||||
|     description: "Quick Delete, Quick edit", |     description: "Quick Delete, Quick edit", | ||||||
|     author: "Vendicated", |     authors: [Devs.Ven], | ||||||
|     dependencies: ["MessageEventsAPI"], |     dependencies: ["MessageEventsAPI"], | ||||||
| 
 | 
 | ||||||
|     start() { |     start() { | ||||||
|  |  | ||||||
|  | @ -1,10 +1,11 @@ | ||||||
| import { addPreSendListener, addPreEditListener, SendListener, removePreSendListener, removePreEditListener } from '../api/MessageEvents'; | import { addPreSendListener, addPreEditListener, SendListener, removePreSendListener, removePreEditListener } from '../api/MessageEvents'; | ||||||
| import { findByProps } from "../webpack"; | import { findByProps } from "../webpack"; | ||||||
| import definePlugin from "../utils/types"; | import definePlugin from "../utils/types"; | ||||||
|  | import { Devs } from '../utils/constants'; | ||||||
| 
 | 
 | ||||||
| export default definePlugin({ | export default definePlugin({ | ||||||
|     name: "Nitro Bypass", |     name: "Nitro Bypass", | ||||||
|     author: "ArjixWasTaken", |     authors: [Devs.Arjix], | ||||||
|     description: "Allows you to stream in nitro quality and send fake emojis.", |     description: "Allows you to stream in nitro quality and send fake emojis.", | ||||||
|     dependencies: ["MessageEventsAPI"], |     dependencies: ["MessageEventsAPI"], | ||||||
|     patches: [ |     patches: [ | ||||||
|  |  | ||||||
|  | @ -1,9 +1,10 @@ | ||||||
| import definePlugin from "../utils/types"; | import definePlugin from "../utils/types"; | ||||||
|  | import { Devs } from '../utils/constants'; | ||||||
| 
 | 
 | ||||||
| export default definePlugin({ | export default definePlugin({ | ||||||
|     name: "NoTrack", |     name: "NoTrack", | ||||||
|     description: "Disable Discord's tracking and crash reporting", |     description: "Disable Discord's tracking and crash reporting", | ||||||
|     author: "Cynosphere", |     authors: [Devs.Cyn], | ||||||
|     required: true, |     required: true, | ||||||
|     patches: [ |     patches: [ | ||||||
|         { |         { | ||||||
|  |  | ||||||
|  | @ -1,10 +1,11 @@ | ||||||
| import definePlugin from "../utils/types"; | import definePlugin from "../utils/types"; | ||||||
| import gitHash from "git-hash"; | import gitHash from "git-hash"; | ||||||
|  | import { Devs } from '../utils/constants'; | ||||||
| 
 | 
 | ||||||
| export default definePlugin({ | export default definePlugin({ | ||||||
|     name: "Settings", |     name: "Settings", | ||||||
|     description: "Adds Settings UI and debug info", |     description: "Adds Settings UI and debug info", | ||||||
|     author: "Vendicated", |     authors: [Devs.Ven], | ||||||
|     required: true, |     required: true, | ||||||
|     patches: [{ |     patches: [{ | ||||||
|         find: "().versionHash", |         find: "().versionHash", | ||||||
|  |  | ||||||
|  | @ -1,8 +1,9 @@ | ||||||
| import definePlugin from '../utils/types'; | import definePlugin from '../utils/types'; | ||||||
|  | import { Devs } from '../utils/constants'; | ||||||
| 
 | 
 | ||||||
| export default definePlugin({ | export default definePlugin({ | ||||||
|     name: "SilentTyping", |     name: "SilentTyping", | ||||||
|     author: "Vendicated", |     authors: [Devs.Ven], | ||||||
|     description: "Hide that you are typing", |     description: "Hide that you are typing", | ||||||
|     patches: [{ |     patches: [{ | ||||||
|         find: "startTyping:", |         find: "startTyping:", | ||||||
|  |  | ||||||
|  | @ -1,10 +1,11 @@ | ||||||
| import definePlugin from "../utils/types"; | import definePlugin from "../utils/types"; | ||||||
| import { addPreSendListener, addPreEditListener, MessageObject, removePreSendListener, removePreEditListener } from '../api/MessageEvents'; | import { addPreSendListener, addPreEditListener, MessageObject, removePreSendListener, removePreEditListener } from '../api/MessageEvents'; | ||||||
|  | import { Devs } from '../utils/constants'; | ||||||
| 
 | 
 | ||||||
| export default definePlugin({ | export default definePlugin({ | ||||||
|     name: "Unindent", |     name: "Unindent", | ||||||
|     description: "Trims leading indentation from codeblocks", |     description: "Trims leading indentation from codeblocks", | ||||||
|     author: "Vendicated", |     authors: [Devs.Ven], | ||||||
|     patches: [ |     patches: [ | ||||||
|         { |         { | ||||||
|             find: "inQuote:", |             find: "inQuote:", | ||||||
|  |  | ||||||
|  | @ -1,10 +1,11 @@ | ||||||
|  | import { Devs } from "../utils/constants"; | ||||||
| import IpcEvents from "../utils/IpcEvents"; | import IpcEvents from "../utils/IpcEvents"; | ||||||
| import definePlugin from '../utils/types'; | import definePlugin from '../utils/types'; | ||||||
| 
 | 
 | ||||||
| const OPEN_URL = "Vencord.Plugins.plugins.ViewIcons.openImage("; | const OPEN_URL = "Vencord.Plugins.plugins.ViewIcons.openImage("; | ||||||
| export default definePlugin({ | export default definePlugin({ | ||||||
|     name: "ViewIcons", |     name: "ViewIcons", | ||||||
|     author: "Vendicated", |     authors: [Devs.Ven], | ||||||
|     description: "Makes Avatars/Banners in user profiles clickable, and adds Guild Context Menu Entries to View Banner/Icon.", |     description: "Makes Avatars/Banners in user profiles clickable, and adds Guild Context Menu Entries to View Banner/Icon.", | ||||||
| 
 | 
 | ||||||
|     openImage(url: string) { |     openImage(url: string) { | ||||||
|  |  | ||||||
|  | @ -8,7 +8,7 @@ function strEnum<T extends Record<string, string>>(obj: T): T { | ||||||
|         o[key] = obj[key] as any; |         o[key] = obj[key] as any; | ||||||
|         o[obj[key]] = key as any; |         o[obj[key]] = key as any; | ||||||
|     }; |     }; | ||||||
|     return o; |     return Object.freeze(o); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| export default strEnum({ | export default strEnum({ | ||||||
|  |  | ||||||
|  | @ -1,2 +1,22 @@ | ||||||
| export const WEBPACK_CHUNK = "webpackChunkdiscord_app"; | export const WEBPACK_CHUNK = "webpackChunkdiscord_app"; | ||||||
| export const REACT_GLOBAL = "Vencord.Webpack.Common.React"; | export const REACT_GLOBAL = "Vencord.Webpack.Common.React"; | ||||||
|  | 
 | ||||||
|  | // Add yourself here if you made more than one plugin
 | ||||||
|  | export const Devs = Object.freeze({ | ||||||
|  |     Ven: { | ||||||
|  |         name: "Vendicated", | ||||||
|  |         id: 343383572805058560n | ||||||
|  |     }, | ||||||
|  |     Arjix: { | ||||||
|  |         name: "ArjixWasTaken", | ||||||
|  |         id: 674710789138939916n | ||||||
|  |     }, | ||||||
|  |     Cyn: { | ||||||
|  |         name: "Cynosphere", | ||||||
|  |         id: 150745989836308480n | ||||||
|  |     }, | ||||||
|  |     Megu: { | ||||||
|  |         name: "Megumin", | ||||||
|  |         id: 545581357812678656n | ||||||
|  |     } | ||||||
|  | }); | ||||||
|  |  | ||||||
|  | @ -14,6 +14,11 @@ export interface Patch { | ||||||
|     replacement: PatchReplacement | PatchReplacement[]; |     replacement: PatchReplacement | PatchReplacement[]; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | export interface PluginAuthor { | ||||||
|  |     name: string; | ||||||
|  |     id: BigInt; | ||||||
|  | } | ||||||
|  | 
 | ||||||
| export interface Plugin extends PluginDef { | export interface Plugin extends PluginDef { | ||||||
|     patches?: Patch[]; |     patches?: Patch[]; | ||||||
|     started: boolean; |     started: boolean; | ||||||
|  | @ -22,7 +27,7 @@ export interface Plugin extends PluginDef { | ||||||
| interface PluginDef { | interface PluginDef { | ||||||
|     name: string; |     name: string; | ||||||
|     description: string; |     description: string; | ||||||
|     author: string; |     authors: PluginAuthor[]; | ||||||
|     start?(): void; |     start?(): void; | ||||||
|     stop?(): void; |     stop?(): void; | ||||||
|     patches?: Omit<Patch, "plugin">[]; |     patches?: Omit<Patch, "plugin">[]; | ||||||
|  |  | ||||||
|  | @ -1,6 +1,6 @@ | ||||||
| import { WEBPACK_CHUNK } from './constants'; | import { WEBPACK_CHUNK } from '../utils/constants'; | ||||||
| import Logger from "./logger"; | import Logger from "../utils/logger"; | ||||||
| import { _initWebpack } from "../webpack"; | import { _initWebpack } from "."; | ||||||
| 
 | 
 | ||||||
| let webpackChunk: any[]; | let webpackChunk: any[]; | ||||||
| 
 | 
 | ||||||
|  | @ -43,7 +43,7 @@ export function _initWebpack(instance: typeof window.webpackChunkdiscord_app) { | ||||||
| 
 | 
 | ||||||
| export function find(filter: FilterFn, getDefault = true) { | export function find(filter: FilterFn, getDefault = true) { | ||||||
|     if (typeof filter !== "function") |     if (typeof filter !== "function") | ||||||
|         throw new Error("Invalid filter. Expected a function got", filter); |         throw new Error("Invalid filter. Expected a function got " + typeof filter); | ||||||
| 
 | 
 | ||||||
|     for (const key in cache) { |     for (const key in cache) { | ||||||
|         const mod = cache[key]; |         const mod = cache[key]; | ||||||
|  | @ -70,7 +70,7 @@ export function find(filter: FilterFn, getDefault = true) { | ||||||
| 
 | 
 | ||||||
| // TODO fix
 | // TODO fix
 | ||||||
| export function findAll(filter: FilterFn, getDefault = true) { | export function findAll(filter: FilterFn, getDefault = true) { | ||||||
|     if (typeof filter !== "function") throw new Error("Invalid filter. Expected a function got", filter); |     if (typeof filter !== "function") throw new Error("Invalid filter. Expected a function got " + typeof filter); | ||||||
| 
 | 
 | ||||||
|     const ret = [] as any[]; |     const ret = [] as any[]; | ||||||
|     for (const key in cache) { |     for (const key in cache) { | ||||||
|  | @ -108,7 +108,7 @@ export function findByDisplayName(deezNuts: string) { | ||||||
| export function waitFor(filter: string | string[] | FilterFn, callback: CallbackFn) { | export function waitFor(filter: string | string[] | FilterFn, callback: CallbackFn) { | ||||||
|     if (typeof filter === "string") filter = filters.byProps([filter]); |     if (typeof filter === "string") filter = filters.byProps([filter]); | ||||||
|     else if (Array.isArray(filter)) filter = filters.byProps(filter); |     else if (Array.isArray(filter)) filter = filters.byProps(filter); | ||||||
|     else if (typeof filter !== "function") throw new Error("filter must be a string, string[] or function, got", filter); |     else if (typeof filter !== "function") throw new Error("filter must be a string, string[] or function, got " + typeof filter); | ||||||
| 
 | 
 | ||||||
|     const existing = find(filter!); |     const existing = find(filter!); | ||||||
|     if (existing) return void callback(existing); |     if (existing) return void callback(existing); | ||||||
|  |  | ||||||
		Loading…
	
		Reference in a new issue