mirror of https://github.com/bvn13/JIrcBot.git
onGenericMessageEvent-s replaced with onMessageEvent-s to prevent spam from notices
parent
0b521d693c
commit
700a2f2be7
|
@ -144,8 +144,12 @@ public class AdminListener extends ImprovedListenerAdapter {
|
|||
case "set" :
|
||||
try {
|
||||
args = commands[1].split(" ", 4); // set, channel, mode/hello-message
|
||||
changeSettings(JircBot.extractServer(event.getBot().getServerHostname()), args[1], args[0], args[2]); //server, channel, set, mode
|
||||
event.respondPrivateMessage("done");
|
||||
if (args.length == 3) {
|
||||
changeSettings(JircBot.extractServer(event.getBot().getServerHostname()), args[0], args[1], args[2]); //server, channel, set, mode
|
||||
event.respondPrivateMessage("done");
|
||||
} else {
|
||||
event.respondPrivateMessage("SYNTAX: ?set <channel> <option> on/off");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
event.respondPrivateMessage(e.toString());
|
||||
logger.error("ERROR", e);
|
||||
|
@ -245,6 +249,7 @@ public class AdminListener extends ImprovedListenerAdapter {
|
|||
break;
|
||||
case "defferedmessages":
|
||||
case "deffered-messages":
|
||||
case "tell" :
|
||||
settings.setDeferredMessagesEnabled(mode);
|
||||
break;
|
||||
case "gs":
|
||||
|
|
|
@ -31,7 +31,7 @@ public class BashOrgListener extends ImprovedListenerAdapter {
|
|||
private ChannelSettingsService channelSettingsService;
|
||||
|
||||
@Override
|
||||
public void onGenericMessage(final GenericMessageEvent event) throws Exception {
|
||||
public void onMessage(final MessageEvent event) throws Exception {
|
||||
|
||||
if (!channelSettingsService.getChannelSettings(JircBot.extractServer(event.getBot().getServerHostname()), getChannelName(event)).getBashOrgEnabled()) {
|
||||
return;
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package ru.bvn13.jircbot.listeners;
|
||||
|
||||
import org.pircbotx.hooks.events.JoinEvent;
|
||||
import org.pircbotx.hooks.events.MessageEvent;
|
||||
import org.pircbotx.hooks.events.NoticeEvent;
|
||||
import org.pircbotx.hooks.types.GenericMessageEvent;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
@ -32,7 +33,7 @@ public class DeferredMessagesListener extends ImprovedListenerAdapter {
|
|||
|
||||
|
||||
@Override
|
||||
public void onGenericMessage(final GenericMessageEvent event) throws Exception {
|
||||
public void onMessage(final MessageEvent event) throws Exception {
|
||||
|
||||
if (!channelSettingsService.getChannelSettings(JircBot.extractServer(event.getBot().getServerHostname()), getChannelName(event)).getDeferredMessagesEnabled()) {
|
||||
return;
|
||||
|
@ -75,11 +76,7 @@ public class DeferredMessagesListener extends ImprovedListenerAdapter {
|
|||
}
|
||||
|
||||
|
||||
private void sendDeferredMessage(final GenericMessageEvent event) {
|
||||
|
||||
if (event instanceof NoticeEvent) {
|
||||
return;
|
||||
}
|
||||
private void sendDeferredMessage(final MessageEvent event) {
|
||||
|
||||
List<DeferredMessage> deferredMessages = deferredMessageService.getDeferredMessagesForUser(this.getChannelName(event), event.getUser().getNick().toLowerCase());
|
||||
if (deferredMessages != null && deferredMessages.size() > 0) {
|
||||
|
|
|
@ -4,6 +4,7 @@ import org.jsoup.Jsoup;
|
|||
import org.jsoup.nodes.Document;
|
||||
import org.jsoup.nodes.Element;
|
||||
import org.jsoup.select.Elements;
|
||||
import org.pircbotx.hooks.events.MessageEvent;
|
||||
import org.pircbotx.hooks.types.GenericMessageEvent;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
@ -33,7 +34,7 @@ public class GoogleSearchListener extends ImprovedListenerAdapter {
|
|||
|
||||
|
||||
@Override
|
||||
public void onGenericMessage(final GenericMessageEvent event) throws Exception {
|
||||
public void onMessage(final MessageEvent event) throws Exception {
|
||||
|
||||
if (!channelSettingsService.getChannelSettings(JircBot.extractServer(event.getBot().getServerHostname()), this.getChannelName(event)).getGoogleSearchEnabled()) {
|
||||
return;
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package ru.bvn13.jircbot.listeners;
|
||||
|
||||
import org.pircbotx.hooks.events.MessageEvent;
|
||||
import org.pircbotx.hooks.types.GenericMessageEvent;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
@ -35,7 +36,7 @@ public class GrammarCorrectorListener extends ImprovedListenerAdapter {
|
|||
|
||||
|
||||
@Override
|
||||
public void onGenericMessage(final GenericMessageEvent event) throws Exception {
|
||||
public void onMessage(final MessageEvent event) throws Exception {
|
||||
|
||||
if (!channelSettingsService.getChannelSettings(JircBot.extractServer(event.getBot().getServerHostname()), this.getChannelName(event)).getGrammarCorrectionEnabled()) {
|
||||
return;
|
||||
|
|
|
@ -39,7 +39,7 @@ public class LinkPreviewListener extends ImprovedListenerAdapter {
|
|||
private ChannelSettingsService channelSettingsService;
|
||||
|
||||
@Override
|
||||
public void onGenericMessage(final GenericMessageEvent event) throws Exception {
|
||||
public void onMessage(final MessageEvent event) throws Exception {
|
||||
|
||||
if (!channelSettingsService.getChannelSettings(JircBot.extractServer(event.getBot().getServerHostname()), getChannelName(event)).getLinkPreviewEnabled()) {
|
||||
return;
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package ru.bvn13.jircbot.listeners;
|
||||
|
||||
import org.pircbotx.hooks.ListenerAdapter;
|
||||
import org.pircbotx.hooks.events.MessageEvent;
|
||||
import org.pircbotx.hooks.types.GenericMessageEvent;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
|
@ -10,7 +11,7 @@ public class PingPongListener extends ListenerAdapter {
|
|||
private static final String COMMAND = "?ping";
|
||||
|
||||
@Override
|
||||
public void onGenericMessage(final GenericMessageEvent event) throws Exception {
|
||||
public void onMessage(final MessageEvent event) throws Exception {
|
||||
|
||||
if (event.getUser().getUserId().equals(event.getBot().getUserBot().getUserId())) {
|
||||
return;
|
||||
|
|
|
@ -26,7 +26,7 @@ public class RegexCheckerListener extends ImprovedListenerAdapter {
|
|||
private ChannelSettingsService channelSettingsService;
|
||||
|
||||
@Override
|
||||
public void onGenericMessage(final GenericMessageEvent event) throws Exception {
|
||||
public void onMessage(final MessageEvent event) throws Exception {
|
||||
|
||||
//TODO: rework with FSM
|
||||
|
||||
|
|
Loading…
Reference in New Issue