Search in sources :

Example 6 with DailyMessage

use of com.github.vaerys.objects.DailyMessage in project DiscordSailv2 by Vaerys-Dawn.

the class EventSetup method addMessage.

private String addMessage(TimedEvent event, String rest, CommandObject command) {
    if (rest == null)
        return "> Missing arguments.\n" + getModes();
    SplitFirstObject messageID = new SplitFirstObject(rest);
    if (messageID.getRest() == null)
        return "> Missing arguments.\n" + getModes();
    for (DailyMessage m : event.getMessages()) {
        if (m.getSpecialID().equalsIgnoreCase(messageID.getFirstWord())) {
            return "> Message Id already in use.";
        }
    }
    DayOfWeek day = null;
    SplitFirstObject message = new SplitFirstObject(messageID.getRest());
    try {
        day = DayOfWeek.valueOf(message.getFirstWord().toUpperCase());
    } catch (IllegalArgumentException e) {
    // do nothing
    }
    if (day == null) {
        event.getMessages().add(new DailyMessage(message.getAll(), day, command.user.longID, messageID.getFirstWord()));
    } else {
        event.getMessages().add(new DailyMessage(message.getRest(), day, command.user.longID, messageID.getFirstWord()));
    }
    event.setSpecialMessages(true);
    return "> New message added.";
}
Also used : DayOfWeek(java.time.DayOfWeek) DailyMessage(com.github.vaerys.objects.DailyMessage) SplitFirstObject(com.github.vaerys.objects.SplitFirstObject)

Example 7 with DailyMessage

use of com.github.vaerys.objects.DailyMessage in project DiscordSailv2 by Vaerys-Dawn.

the class Constants method defaultDailyMessages.

public static ArrayList<DailyMessage> defaultDailyMessages(long creatorID) {
    ArrayList<DailyMessage> dailyMessages = new ArrayList<DailyMessage>() {

        {
            add(new DailyMessage(Constants.DAILY_MESSAGE_1, DayOfWeek.MONDAY, creatorID, DAILY_SPECIALID));
            add(new DailyMessage(Constants.DAILY_MESSAGE_2, DayOfWeek.TUESDAY, creatorID, DAILY_SPECIALID));
            add(new DailyMessage(Constants.DAILY_MESSAGE_3, DayOfWeek.WEDNESDAY, creatorID, DAILY_SPECIALID));
            add(new DailyMessage(Constants.DAILY_MESSAGE_4, DayOfWeek.THURSDAY, creatorID, DAILY_SPECIALID));
            add(new DailyMessage(Constants.DAILY_MESSAGE_5, DayOfWeek.FRIDAY, creatorID, DAILY_SPECIALID));
            add(new DailyMessage(Constants.DAILY_MESSAGE_6, DayOfWeek.SATURDAY, creatorID, DAILY_SPECIALID));
            add(new DailyMessage(Constants.DAILY_MESSAGE_7, DayOfWeek.SUNDAY, creatorID, DAILY_SPECIALID));
        }
    };
    return dailyMessages;
}
Also used : ArrayList(java.util.ArrayList) DailyMessage(com.github.vaerys.objects.DailyMessage)

Aggregations

DailyMessage (com.github.vaerys.objects.DailyMessage)7 DayOfWeek (java.time.DayOfWeek)5 ArrayList (java.util.ArrayList)3 QueueObject (com.github.vaerys.objects.QueueObject)2 SplitFirstObject (com.github.vaerys.objects.SplitFirstObject)2 CommandObject (com.github.vaerys.commands.CommandObject)1 Globals (com.github.vaerys.main.Globals)1 UserObject (com.github.vaerys.masterobjects.UserObject)1 GlobalFile (com.github.vaerys.templates.GlobalFile)1 JsonObject (com.google.gson.JsonObject)1 ZoneOffset (java.time.ZoneOffset)1 ZonedDateTime (java.time.ZonedDateTime)1 List (java.util.List)1 ListIterator (java.util.ListIterator)1 Random (java.util.Random)1 Collectors (java.util.stream.Collectors)1 ReactionEmoji (sx.blah.discord.handle.impl.obj.ReactionEmoji)1