/SevenBot

A Discord Bot

Primary LanguagePythonMIT LicenseMIT

SevenBot

A Discord bot with scheduling functionality and automatic time zone conversion.

Schedule a series of messages, and have them execute on a specified day of the week and time. Have users set their own time zones, then have times automatically converted.


Configuration Instructions

For anyone who will be the admin for the bot, be sure to give that user the role Bot Admin to ensure that they can use all the proper configuration commands.

config.json

An explanation of the configuration file:

{
    "DISCORD_TOKEN": "Your Bot Token Here",
    "DISCORD_GUILD": "Name of the server the bot is active in",
    "timeZone": "The primary time zone of the server. Used for message scheduling and time zone conversion",
    "commandPrefix": "The command prefix of the bot. i.e. '!', '?', etc",
    "features": {
        "scheduling": "Set as true to enable message scheduling functionality",
        "timeZoneConversion": "Set as true to enable automatic time zone conversion"
    }
}

Enable or disable the scheduling and timeZoneConversion fields depending on if you want such functions enabled or not.

An example config file:

{
    "DISCORD_TOKEN": "xxxxxxxxxxxxxxxxxx",
    "DISCORD_GUILD": "My Discord Server",
    "timeZone": "America/Los_Angeles",
    "commandPrefix": "!",
    "features": {
        "scheduling": true,
        "timeZoneConversion": true
    }
}

messageinfo.json

This file stores the scheduling information for the scheduled messages.

An example messageinfo.json file:

{
    "scheduled_messages": [{
            "channel_id": "123456789",
            "day_of_week": "mon",
            "hour": "11",
            "minute": "30",
            "message_body": "**It's time for Music Monday!** Share and talk about a song/artist/album you've been listening to lately!"
        },
        {
            "channel_id": "987654321",
            "day_of_week": "tue",
            "hour": "15",
            "minute": "15",
            "message_body": "It's 3:15 PM on Tuesday."
        }
    ]
}

responses.json

This file defines some responses based on the contents of messages. For example, if you wanted the bot to respond "Goodbye" if anyone includes the word "hello" in their message and vice versa, an example file would look like this:

{
    "responses": [{
            "prompt": "hello",
            "response": "Goodbye",
            "caseSensitive": false
        },
        {
            "prompt": "Goodbye",
            "response": "hello",
            "caseSensitive": true
        }
    ]
}

The caseSensitive option defines whether the prompt has to match the case of the message text. In our example, the bot would only respond with "hello" to a message such as "Goodbye John", but would not respond to a message such as "goodbye John".

zonesdict.json

This file is automatically generated to store the time zones of users in the server. If it is deleted, users will have to set their time zones again.


Commands

Command Description "Bot Admin" Role Only?
listschedule Lists all currently scheduled messages Yes
refresh Reads messageinfo.json again and refreshes the message storage Yes
settimezone Sets your personal time zone No
mytimezone Views your personal time zone No
timezones Lists the time zone database names No
listuserzones Lists all users and their time zones, if set Yes
savezonesdict Saves all user zones to a json file. Run this before bringing bot offline, just in case. Yes
repository Links to the main GitHub page for this bot No