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.";
}
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;
}
Aggregations