<commit_before>/**
 * Scott enough for ya?
 */

/*
 * AetheBot - A Discord Chatbot
 *
 * Created by <NAME> on 19/05/19.
 * Copyright (c) 2018 <NAME>. All rights reserved.
 *
 * This source code is licensed under the permissive MIT license.
 */

import { GlobalFeature, MessageContext } from "./feature"

const scomo = "https://cdn.discordapp.com/attachments/293954139845820416/579468190971854849/scomo.jpg"

export class ScomoFeature extends GlobalFeature {
    public handleMessage(context: MessageContext<this>): boolean {
        const msg = context.message.cleanContent.toLowerCase()
        if (!msg.includes("scomo")) {
            return false
        }
        const days = 1000 * 60 * 60 * 24
        // const earliestParliament = new Date("2019-07-02T00:00:00+1000")
        // const latestElection = new Date(earliestParliament.getTime() + (1095 * days))
        const latestElection = new Date("2022-05-21T00:00:00+1000")
        const timeBetween = latestElection.getTime() - new Date().getTime()
        if (timeBetween < 0) {
            return false
        }
        const daysBetween = Math.ceil(timeBetween / days)
        const replyMsg = `Australia re-elects old mate Scomo in ${daysBetween} days.` +
            `\n${scomo}`
        context.sendReply(replyMsg)
        return true
    }
}<commit_msg>feat(scomo): getting ready for election day<commit_after>/**
 * Scott enough for ya?
 */

/*
 * AetheBot - A Discord Chatbot
 *
 * Created by <NAME> on 19/05/19.
 * Copyright (c) 2018 <NAME>. All rights reserved.
 *
 * This source code is licensed under the permissive MIT license.
 */

import { GlobalFeature, MessageContext } from "./feature"

const scomo = "https://cdn.discordapp.com/attachments/293954139845820416/579468190971854849/scomo.jpg"

export class ScomoFeature extends GlobalFeature {
    public handleMessage(context: MessageContext<this>): boolean {
        const msg = context.message.cleanContent.toLowerCase()
        if (!msg.includes("scomo")) {
            return false
        }
        const days = 1000 * 60 * 60 * 24
        // const earliestParliament = new Date("2019-07-02T00:00:00+1000")
        // const latestElection = new Date(earliestParliament.getTime() + (1095 * days))
        const latestElection = new Date("2022-05-21T00:00:00+1000")
        const currentTime = new Date().getTime()
        const timeBetween = latestElection.getTime() - currentTime
        let timePeriod = ""
        if (timeBetween < 0 && (timeBetween / days) > -1) {
            timePeriod = "today"
        } else {
            const daysBetween = Math.ceil(timeBetween / days)
            if (daysBetween === 1) {
                timePeriod = `in ${daysBetween} day`
            } else if (daysBetween > 1) {
                timePeriod = `in ${daysBetween} days`
            }
        }
        if (timePeriod === "") {
            context.sendReply(scomo);
            return true;
        } else {
            const replyMsg = `Australia re-elects old mate Scomo ${timePeriod}.` +
            `\n${scomo}`
            context.sendReply(replyMsg)
        }
        return true
    }
}
{'fraction_non_alphanumeric': 0.11819346572709802, 'fraction_numerical': 0.06310057655349136, 'mean_word_length': 2.3798701298701297, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1641291', 'n_tokens_mistral': 1067, 'n_tokens_neox': 920, 'n_words': 239}