Search in sources :

Example 6 with PropertyHandler

use of com.github.jonteohr.tejbz.PropertyHandler in project pgda by jonteohr.

the class Schedule method sendSchedule.

public static void sendSchedule(InteractionHook hook) {
    PropertyHandler prop = new PropertyHandler();
    EmbedBuilder msg = new EmbedBuilder();
    msg.setAuthor("PGDA", null, App.authorImage);
    msg.setColor(App.color);
    msg.setTitle("This weeks schedule");
    msg.setImage(prop.getPropertyValue("schedule_url"));
    hook.sendMessageEmbeds(msg.build()).queue();
}
Also used : EmbedBuilder(net.dv8tion.jda.api.EmbedBuilder) PropertyHandler(com.github.jonteohr.tejbz.PropertyHandler)

Example 7 with PropertyHandler

use of com.github.jonteohr.tejbz.PropertyHandler in project pgda by jonteohr.

the class AutoMessage method autoMessageTimer.

public static void autoMessageTimer() {
    Timer timer = new Timer();
    AutoMessageSQL sql = new AutoMessageSQL();
    timer.scheduleAtFixedRate(new TimerTask() {

        @Override
        public void run() {
            if (count < sql.getInterval())
                return;
            String message = autoMessages.get(pagination);
            if (message.contains("[video]")) {
                PropertyHandler props = new PropertyHandler();
                message = message.replace("[video]", props.getPropertyValue("recent_video"));
            }
            Twitch.twitchClient.getChat().sendMessage("tejbz", message);
            count = 0;
            if (pagination == (autoMessages.size() - 1))
                pagination = 0;
            else
                pagination++;
        }
    }, 7 * 60 * 1000, 7 * 60 * 1000);
}
Also used : AutoMessageSQL(com.github.jonteohr.tejbz.twitch.sql.AutoMessageSQL) Timer(java.util.Timer) TimerTask(java.util.TimerTask) PropertyHandler(com.github.jonteohr.tejbz.PropertyHandler)

Example 8 with PropertyHandler

use of com.github.jonteohr.tejbz.PropertyHandler in project pgda by jonteohr.

the class Video method sendVideo.

public static void sendVideo(SlashCommandInteractionEvent e, InteractionHook hook) {
    PropertyHandler prop = new PropertyHandler();
    String url = prop.getPropertyValue("recent_video");
    hook.sendMessage(e.getMember().getAsMention() + " Check out the latest video on the YouTube channel!\n" + url).queue();
}
Also used : PropertyHandler(com.github.jonteohr.tejbz.PropertyHandler)

Aggregations

PropertyHandler (com.github.jonteohr.tejbz.PropertyHandler)8 PermissionHandler (com.github.jonteohr.tejbz.PermissionHandler)2 EmbedBuilder (net.dv8tion.jda.api.EmbedBuilder)2 AutoMessageSQL (com.github.jonteohr.tejbz.twitch.sql.AutoMessageSQL)1 OAuth2Credential (com.github.philippheuer.credentialmanager.domain.OAuth2Credential)1 EventSubscriber (com.github.philippheuer.events4j.simple.domain.EventSubscriber)1 CreateClipList (com.github.twitch4j.helix.domain.CreateClipList)1 Stream (com.github.twitch4j.helix.domain.Stream)1 MalformedURLException (java.net.MalformedURLException)1 URL (java.net.URL)1 Timer (java.util.Timer)1 TimerTask (java.util.TimerTask)1 Matcher (java.util.regex.Matcher)1