mirror of
https://github.com/Equicord/Equicord.git
synced 2025-06-19 11:27:02 -04:00
Replace API add/remove funcs with methods in plugin definition (#3028)
This commit is contained in:
parent
30647b6bd9
commit
317121fc08
32 changed files with 484 additions and 487 deletions
|
@ -16,7 +16,7 @@
|
|||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import { addPreEditListener, addPreSendListener, MessageObject, removePreEditListener, removePreSendListener } from "@api/MessageEvents";
|
||||
import { MessageObject } from "@api/MessageEvents";
|
||||
import { Devs } from "@utils/constants";
|
||||
import definePlugin from "@utils/types";
|
||||
|
||||
|
@ -24,7 +24,7 @@ export default definePlugin({
|
|||
name: "Unindent",
|
||||
description: "Trims leading indentation from codeblocks",
|
||||
authors: [Devs.Ven],
|
||||
dependencies: ["MessageEventsAPI"],
|
||||
|
||||
patches: [
|
||||
{
|
||||
find: "inQuote:",
|
||||
|
@ -55,13 +55,11 @@ export default definePlugin({
|
|||
});
|
||||
},
|
||||
|
||||
start() {
|
||||
this.preSend = addPreSendListener((_, msg) => this.unindentMsg(msg));
|
||||
this.preEdit = addPreEditListener((_cid, _mid, msg) => this.unindentMsg(msg));
|
||||
onBeforeMessageSend(_, msg) {
|
||||
return this.unindentMsg(msg);
|
||||
},
|
||||
|
||||
stop() {
|
||||
removePreSendListener(this.preSend);
|
||||
removePreEditListener(this.preEdit);
|
||||
onBeforeMessageEdit(_cid, _mid, msg) {
|
||||
return this.unindentMsg(msg);
|
||||
}
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue