Minor changes
This commit is contained in:
parent
e3edb09f38
commit
53ef0be7b8
|
@ -37,6 +37,25 @@ export default new class EmoteModule extends BuiltinModule {
|
|||
|
||||
get mostUsed() { return this._mostUsed || (this._mostUsed = []) }
|
||||
|
||||
get settingPath() { return ['emotes', 'default', 'enable'] }
|
||||
|
||||
async enabled() {
|
||||
GlobalAc.add(';', this);
|
||||
|
||||
if (!this.database.size) {
|
||||
await this.loadLocalDb();
|
||||
}
|
||||
|
||||
this.patchMessageContent();
|
||||
MonkeyPatch('BD:EMOTEMODULE', WebpackModules.getModuleByName('MessageActions')).instead('sendMessage', this.handleSendMessage.bind(this));
|
||||
MonkeyPatch('BD:EMOTEMODULE', WebpackModules.getModuleByName('MessageActions')).instead('editMessage', this.handleEditMessage.bind(this));
|
||||
}
|
||||
|
||||
async disabled() {
|
||||
for (const patch of Patcher.getPatchesByCaller('BD:EMOTEMODULE')) patch.unpatch();
|
||||
GlobalAc.remove(';');
|
||||
}
|
||||
|
||||
addToMostUsed(emote) {
|
||||
const isMostUsed = this.mostUsed.find(mu => mu.key === emote.name);
|
||||
if (isMostUsed) {
|
||||
|
@ -53,25 +72,6 @@ export default new class EmoteModule extends BuiltinModule {
|
|||
}
|
||||
}
|
||||
|
||||
get settingPath() { return ['emotes', 'default', 'enable'] }
|
||||
|
||||
async enabled() {
|
||||
|
||||
GlobalAc.add(';', this);
|
||||
|
||||
if (!this.database.size) {
|
||||
await this.loadLocalDb();
|
||||
}
|
||||
|
||||
this.patchMessageContent();
|
||||
MonkeyPatch('BD:EMOTEMODULE', WebpackModules.getModuleByName('MessageActions')).instead('sendMessage', this.handleSendMessage.bind(this));
|
||||
MonkeyPatch('BD:EMOTEMODULE', WebpackModules.getModuleByName('MessageActions')).instead('editMessage', this.handleEditMessage.bind(this));
|
||||
}
|
||||
|
||||
async disabled() {
|
||||
for (const patch of Patcher.getPatchesByCaller('BD:EMOTEMODULE')) patch.unpatch();
|
||||
}
|
||||
|
||||
processMarkup(markup) {
|
||||
const newMarkup = [];
|
||||
if (!(markup instanceof Array)) return markup;
|
||||
|
|
|
@ -36,6 +36,10 @@ export default new class AutoComplete {
|
|||
this.sets[prefix] = controller;
|
||||
}
|
||||
|
||||
remove(prefix) {
|
||||
if (this.sets.hasOwnProperty(prefix)) delete this.sets[prefix];
|
||||
}
|
||||
|
||||
validPrefix(prefix) {
|
||||
return this.sets.hasOwnProperty(prefix);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue