Beispiel #1
0
    def execute(self, client, input, inventory, channel):
        toons_str = ""
        i = 0
        for name in inventory.toons_name_list:
            toons_str = toons_str + name + "\n"
            i = i + 1
            if i == 100:
                yield from utils.embed_and_send(client, channel, 'Toons',
                                                toons_str)
                i = 0
                toons_str = ""

        if i > 0:
            yield from utils.embed_and_send(client, channel, 'Toons',
                                            toons_str)
Beispiel #2
0
def on_ready():
    global notifications_channel, main_channel

    syslog.syslog('Logged in as')
    syslog.syslog(client.user.name)
    syslog.syslog(client.user.id)
    syslog.syslog('------')
    for server in client.servers:
        print(str(server.id) + ", " + str(server.name))
        for channel in server.channels:
            print("----->" + str(channel.id) + ", " + str(channel.name))
            if server.name == 'Guild notifications' and channel.name == 'general':
                notifications_channel = channel
            elif server.name == 'SWGOH Guild Raiders' and channel.name == 'general':
                main_channel = channel

    # Notify guild activity reset every day at midnight and after reset
    scheduler.add_job(notify_guild_activity_midnight,
                      trigger='cron',
                      minute='0',
                      hour="0")
    scheduler.add_job(notify_guild_activity_after_reset,
                      trigger='cron',
                      minute='30',
                      hour="17")

    yield from utils.embed_and_send(client, notifications_channel, 'Welcome',
                                    'Greeter is online!')
Beispiel #3
0
def notify_guild_activity_after_reset():
    now = datetime.datetime.now()
    day = now.strftime("%A")

    activity = ""
    if day == "Sunday":
        activity = "Spend Cantina energy\nSave Normal Energy"
    elif day == "Monday":
        activity = "Spend Normal energy on Light Side Battles"
    elif day == "Tuesday":
        activity = "Complete Galactic War Battles (24 with restart)\nSave Normal Energy"
    elif day == "Wednesday":
        activity = "Spend Normal energy on Hard Mode Battles"
    elif day == "Thursday":
        activity = "Complete Daily Challenges (10)\nSave Normal Energy"
    elif day == "Friday":
        activity = "Spend Normal energy on Dark Side Battles"
    elif day == 'Saturday':
        activity = "Complete Arena Battles (5)"

    syslog.syslog(
        "Sending guild activity reminder after reset for %s, activity = %s!!!!"
        % (day, activity))
    yield from utils.embed_and_send(
        client, main_channel,
        'Guild Activity Reminder after reset (' + day + ')', activity)
Beispiel #4
0
    def execute(self, client, input, inventory, channel):
        if len(input) == 0:
            yield from utils.embed_and_send(
                client, channel, "Light Side TB Platoons",
                "Must supply a phase. Usage: @greeter lbtbplatoons P4-1")
            return

        phase = input.upper()
        if phase not in self.allowed_phases:
            yield from utils.embed_and_send(
                client, channel, "Light Side TB Platoons",
                "Not a valid phase. Valid phases = " +
                str(self.allowed_phases))
            return

        platoons_info = inventory.lstbplatoons_dict.get(phase, None)
        if platoons_info is None:
            yield from utils.embed_and_send(
                client, channel, "Light Side TB Platoons",
                "Information not available for " + phase + " from the last TB")
            return

        if len(platoons_info['items']) == 0:
            yield from utils.embed_and_send(
                client, channel, "Light Side TB Platoons",
                "All the platoons in " + phase + " were filled in the last TB")
            return

        rarity = platoons_info['rarity']
        items = platoons_info['items']
        yield from utils.embed_and_send(
            client, channel, "Light Side TB Platoons",
            "During last TB, we fell short of following toons/ships at " +
            str(rarity) + "* to complete the platoons in " + phase)

        headers = ['Toon/Ship', 'Deficit']
        table_data = []

        for i in items:
            table_data.append([i['name'], i['count']])

        yield from utils.send_as_table(table_data, headers, 20, channel,
                                       client)
Beispiel #5
0
 def execute(self, client, input, inventory, channel):
     yield from utils.embed_and_send(client, channel, 'Ships',
                                     inventory.ships_str)