DigitalPulseSoftware / NotaBot

Source code of the bot of the french programming discord server NaN (Not a Name).
https://discord.gg/zcWp9sC
MIT License
26 stars 10 forks source link

Add ability to create a Scheduled event with Not A Bot twitch stream detection #60

Closed Elanis closed 1 year ago

Elanis commented 2 years ago

This PR adds API to use Scheduled events and create them if needed when a Twitch stream begins.

Changelog:

Events examples: image image

Tested with a custom command as I can't test real twitch notifications.

The custom command:

    self:RegisterCommand({
        Name = "testa",
        Silent = false,
        Args = {
        },
        Help = "Test things",
        Func = function(commandMessage, channel)
            commandMessage:reply("ok")

            commandMessage.guild:createScheduledEvents(
                enums.scheduledEventsEntityTypes.external,
                string.format("https://twitch.tv/%s", "elanis42"),
                "Test title",
                enums.scheduledEventsPrivacyLevel.guild_only,
                os.date("!%Y-%m-%dT%TZ", os.time() + 1),
                os.date("!%Y-%m-%dT%TZ", os.time() + 3600)
            )
        end
    })