add contextmenu patch removal
This commit is contained in:
parent
b8dc9c0d25
commit
4c3659f857
|
@ -56,7 +56,7 @@ export default new class EmoteModule extends BuiltinModule {
|
|||
GlobalAc.add(';', this);
|
||||
|
||||
// Add favourite button to context menu
|
||||
DiscordContextMenu.add(target => [
|
||||
this.removeFavCm = DiscordContextMenu.add('BD:EmoteModule:FavCM', target => [
|
||||
{
|
||||
text: 'Favourite',
|
||||
type: 'toggle',
|
||||
|
@ -96,6 +96,7 @@ export default new class EmoteModule extends BuiltinModule {
|
|||
for (const patch of Patcher.getPatchesByCaller('BD:EMOTEMODULE')) patch.unpatch();
|
||||
// Remove ; prefix from autocomplete
|
||||
GlobalAc.remove(';');
|
||||
if (this.removeFavCm) this.removeFavCm();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -35,12 +35,18 @@ export class DiscordContextMenu {
|
|||
|
||||
/**
|
||||
* add items to Discord context menu
|
||||
* @param {any} id unique id for group
|
||||
* @param {any} items items to add
|
||||
* @param {Function} [filter] filter function for target filtering
|
||||
*/
|
||||
static add(items, filter) {
|
||||
static add(id, items, filter) {
|
||||
if (!this.patched) this.patch();
|
||||
this.menus.push({ items, filter });
|
||||
this.menus.push({ id, items, filter });
|
||||
return () => this.remove(id);
|
||||
}
|
||||
|
||||
static remove(id) {
|
||||
this._menus = this._menus.filter(menu => menu.id !== id);
|
||||
}
|
||||
|
||||
static get menus() {
|
||||
|
|
Loading…
Reference in New Issue