Search in sources :

Example 16 with EventSubscriber

use of sx.blah.discord.api.events.EventSubscriber in project lavaplayer by sedmelluq.

the class Main method onMessageReceived.

@EventSubscriber
public void onMessageReceived(MessageReceivedEvent event) {
    IMessage message = event.getMessage();
    String[] command = message.getContent().split(" ", 2);
    IGuild guild = message.getGuild();
    if (guild != null) {
        if ("~play".equals(command[0]) && command.length == 2) {
            loadAndPlay(message.getChannel(), command[1]);
        } else if ("~skip".equals(command[0])) {
            skipTrack(message.getChannel());
        }
    }
}
Also used : IMessage(sx.blah.discord.handle.obj.IMessage) IGuild(sx.blah.discord.handle.obj.IGuild) EventSubscriber(sx.blah.discord.api.events.EventSubscriber)

Example 17 with EventSubscriber

use of sx.blah.discord.api.events.EventSubscriber in project DiscordSailv2 by Vaerys-Dawn.

the class AnnotationListener method onMessageDeleteEvent.

@EventSubscriber
public void onMessageDeleteEvent(MessageDeleteEvent event) {
    if (event.getChannel().isPrivate())
        return;
    if (!Globals.isReady)
        return;
    if (event.getMessage() == null)
        return;
    if (event.getGuild().getUserByID(event.getAuthor().getLongID()) == null)
        return;
    CommandObject command = new CommandObject(event.getMessage());
    if (!command.guild.config.moduleLogging)
        return;
    LoggingHandler.logDelete(command, event.getMessage());
}
Also used : CommandObject(com.github.vaerys.commands.CommandObject) EventSubscriber(sx.blah.discord.api.events.EventSubscriber)

Example 18 with EventSubscriber

use of sx.blah.discord.api.events.EventSubscriber in project DiscordSailv2 by Vaerys-Dawn.

the class AnnotationListener method onSystemMessageReceivedEvent.

@EventSubscriber
public void onSystemMessageReceivedEvent(MessageSendEvent event) {
    IMessage message = event.getMessage();
    if (message.getType() != IMessage.Type.CHANEL_PINNED_MESSAGE)
        return;
    if (!message.getAuthor().equals(event.getClient().getOurUser()))
        return;
    RequestHandler.deleteMessage(message);
}
Also used : IMessage(sx.blah.discord.handle.obj.IMessage) EventSubscriber(sx.blah.discord.api.events.EventSubscriber)

Aggregations

EventSubscriber (sx.blah.discord.api.events.EventSubscriber)18 IMessage (sx.blah.discord.handle.obj.IMessage)6 CommandObject (com.github.vaerys.commands.CommandObject)5 IGuild (sx.blah.discord.handle.obj.IGuild)3 GuildObject (com.github.vaerys.masterobjects.GuildObject)2 UserObject (com.github.vaerys.masterobjects.UserObject)2 ArrayList (java.util.ArrayList)2 GuildSettings (com.cloudcraftgaming.discal.api.object.GuildSettings)1 Restart (com.github.vaerys.commands.creator.Restart)1 LogObject (com.github.vaerys.objects.LogObject)1 Command (com.github.vaerys.templates.Command)1 AudioTrack (com.sedmelluq.discord.lavaplayer.track.AudioTrack)1 AlmanaxCommand (commands.classic.AlmanaxCommand)1 LanguageCommand (commands.config.LanguageCommand)1 RSSCommand (commands.config.RSSCommand)1 ServerCommand (commands.config.ServerCommand)1 TwitterCommand (commands.config.TwitterCommand)1 Guild (data.Guild)1 Language (enums.Language)1 AlmanaxCalendar (finders.AlmanaxCalendar)1