Skip to content

Commit

Permalink
Make message referencing a module
Browse files Browse the repository at this point in the history
  • Loading branch information
Matyrobbrt committed May 30, 2024
1 parent 7885660 commit 18cc24a
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package net.neoforged.camelot.config.module

import groovy.transform.CompileStatic

/**
* The module controlling message referencing.
*/
@CompileStatic
class MessageReferencing extends ModuleConfiguration {
}
3 changes: 1 addition & 2 deletions src/main/java/net/neoforged/camelot/BotMain.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
import net.neoforged.camelot.db.transactionals.StatsDAO;
import net.neoforged.camelot.listener.CountersListener;
import net.neoforged.camelot.listener.DismissListener;
import net.neoforged.camelot.listener.ReferencingListener;
import net.neoforged.camelot.log.ChannelLogging;
import net.neoforged.camelot.log.JoinsLogging;
import net.neoforged.camelot.log.MessageLogging;
Expand Down Expand Up @@ -218,7 +217,7 @@ public static void main(String[] args) {
.setActivity(Activity.customStatus("Listening for your commands"))
.setMemberCachePolicy(MemberCachePolicy.ALL)
.addEventListeners(new ModerationActionRecorder())
.addEventListeners(BUTTON_MANAGER, new CountersListener(), new ReferencingListener(), new DismissListener());
.addEventListeners(BUTTON_MANAGER, new CountersListener(), new DismissListener());

try {
Database.init();
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package net.neoforged.camelot.module;

import com.google.auto.service.AutoService;
import net.dv8tion.jda.api.JDA;
import net.neoforged.camelot.config.module.MessageReferencing;
import net.neoforged.camelot.listener.ReferencingListener;

/**
* Module for message referencing using {@code .} replies.
*/
@AutoService(MessageReferencing.class)
public class MessageReferencingModule extends CamelotModule.Base<MessageReferencing> {
public MessageReferencingModule() {
super(MessageReferencing.class);
}

@Override
public void setup(JDA jda) {
jda.addEventListener(new ReferencingListener());
}

@Override
public String id() {
return "message-referencing";
}
}

0 comments on commit 18cc24a

Please sign in to comment.