TLDBotto ("Tildy") is a configurable Discord bot with a penchant for hijinks.
python .
-
Nominate somebody else's message as a potential motto with
@MottoBotto
in a reply to the message. -
Approve somebody's nomination of your message with an emoji reaction.
-
Change your leaderboard emoji with a direct message to MottoBotto of
!emoji <new-emoji>
. -
Get a link to the leaderboard with a direct message to MottoBotto of
!link
. -
Delete all your data from the leaderboard with a direct message to MottoBotto of
!delete
. -
Send
!help
as a direct message to MottoBotto to get a list of possible commands.
To nominate a motto for consideration, reply to the Discord message with one of MottoBotto's trigger phrases. The default triggers can be found in the section below. MottoBotto will respond to your message with an emoji reaction indicating whether the nomination was accepted pending author approval, rejected, invalid, or previously nominated. Mottos must be manually approved by moderators, and will then be available for display, along with a leaderboard for motto-makers, in a simple web view.
Mottos that are considered valid by MottoBotto are:
- at least 2 words in length,
- between 5 and 240 characters in length,
- are not purely punctuation, emoji, numeric, or url, and
- do not tag any Discord users.
Any suggested motto that doesn't conform to these rules will be rejected.
MottoBotto will also reject any nomination that is a statement made by either yourself or MottoBotto.
- The rules of the server should always be followed, and trump any other rules written here.
- Aim to nominate mottos that have a useful sentiment rather than solely japes. The aim is to have a useful database of mottos from a variety of users that people can look over and get use from.
- Do not abuse MottoBotto. Channels should not become spammed with nominations at the expense of the actual conversation that is happening. MottoBotto should aid the discussion, not hinder it.
- Don’t fish for mottos. While there is a leaderboard, don’t try and cheat the system just to raise up the ranks. Instead, contribute to discussion naturally and helpfully and your reign will come.
- Nominate somebody's motto with one of the trigger phrases listed below.
- MottoBotto will respond to your nomination message with a "pending" emoji.
- The author of the motto you nominated responds to your nomination message with an approval emoji.
- MottoBotto will store the nominated motto in the leaderboard, and convert its "pending" emoji to a "success" emoji.
To add an emoji to your name on the leaderboard, change the emoji, or remove it, send !emoji
as a direct message to MottoBotto.
!emoji 🚀
will set the 🚀 emoji for your user.!emoji
will clear any emoji for your user.
MottoBotto will respond with a reaction indicating a successful update or a problem with your request.
If a leaderboard is configured for MottoBotto, you can retrieve a link to it by sending the !link
command as a direct message to MottoBotto.
To delete all your data from the leaderboard, which includes your user information and any mottos of yours that were nominated by other people, send the !delete
command as a direct message to MottoBotto. You will receive a reply asking you to respond with a particular emoji to confirm you wish to proceed. After you have confirmed, all your data will be deleted.
MottoBotto requires a config.json
configuration file, with the following sections.
Section | Key | Default Value | Required | Description |
---|---|---|---|---|
authentication |
discord |
Empty string | Yes | MottoBotto's DIscord bot token. |
airtable_key |
Empty string | Yes | The API key for access to Airtable's API. | |
airtable_base |
Empty string | Yes | The ID of the Airtable base to store the mottos. | |
channels |
exclude |
Empty list | No | A list of Discord channel names to ignore when reacting to triggers. |
include |
Empty list | No | A list of Discord channels to specifically respond to triggers within. If specified, all other channels are ignored. | |
voting |
any_channel_guilds |
["833842753799848016", "880491989995499600"] |
No | A list of Discord server IDs where voting is allowed in any channel. |
members_not_required |
An empty dictionary | No | A dict where the keys are Discord guild IDs and the values are a list of IDs that are not required to vote. | |
ping_disallowed_roles |
{"name:"voting_ping_disallowed"} | No | Roles that are disallowed from using the !remaining !ping command. |
|
reactions |
success |
See below. | No | The emoji to react to a successful nomination with. |
repeat |
See below. | No | The emoji to react to a nomination that has already been nominated with. | |
skynet |
See below. | No | The emoji to react to a nomination of a MottoBotto message with. | |
fishing |
See below. | No | The emoji to react to a nomination of the user's own message with. | |
invalid |
See below. | No | The emoji to react to invalid nominations with. | |
invalid_emoji |
See below. | No | The emoji to react to invalid emoji updates with. | |
valid_emoji |
See below. | No | The emoji to react to successful emoji updates with. | |
pending |
See below. | No | The emoji to react to nominations that have not yet been approved by the nominee. | |
deleted |
See below. | No | The emoji to react nomination approvals where the nominated message has since been deleted. | |
reject |
See below. | No | The emoji to react to any rejected nomination with. | |
delete_confirmed |
See below. | No | The emoji to react with once the user's data has all been deleted after a !delete command. |
|
should_reply |
N/A | true |
No | Whether to send message replies in response to nominations or not. If false , the only notifications users will receive are emoji reactions on their nomination message. |
rules |
matching |
^.{5,240}$ ^(\S+\s+)\S+ |
No | A list of regular expressions to match against the nominated motto text that must all match for the motto to be accepted. The message is first stripped of leading and trailing whitespace before matching. * |
excluding |
<@.*> ^[\d\W\s]*$ |
No | A list of regular expressions to match against the nominated motto text, where any successful match will result in an invalid motto response. The message is first stripped of leading and trailing whitespace before matching. * | |
triggers |
new_motto |
!motto$ |
No | A list of regular expressions to match against every incoming message in the relevant channels (see channels above) to recognise a new nomination. They are all prepended with ^ before matching, to ensure they match the start of the message. The message is first stripped of leading and trailing whitespace before matching. * |
at_triggers |
N/A | See below. | No | Similar to triggers but requiring that the bot is mentioned at the start of the message. |
pattern_reactions |
N/A | See below. | No | Configurable reactions based on regex matches. |
reminder_channel |
N/A | See below. | No | Channel ID to which meal reminders should be sent. |
leaderboard_link |
N/A | None |
No | A link to the motto leaderboard. If not configured, the !link DM will not be recognised. |
trigger_on_mention |
N/A | true |
No | Whether a message that starts with an @ mention of MottoBotto triggers a nomination. If this is false , then at least one new_motto trigger must be configured. |
delete_unapproved_after_hours |
N/A | 24 |
No | The number of hours before an unapproved motto suggestion is removed from Airtable. |
confirm_delete_reaction |
N/A | 🧨 | No | The emoji the user is required to respond with to confirm deletion of all their data. |
support_channel |
N/A | None |
No | The name of a channel in which users of the bot can ask for help. If defined, this is reported in the output of !help . |
id |
N/A | None |
No | A unique ID for this bot, used for development when multiple bots may be running. This is reported by !version . |
watching_statūs |
N/A | ["for food", "for snails", "for apologies", "for love"] |
No | An array of statūs that the boss chooses from at random, changing every 12 hours. It is prepended with "Watching…" |
*Note: Regular expressions used for motto nomination rule matching are matched with case sensitivity, and must include the ^
and $
if you wish to match against the entire message string. Those used for trigger phrases are matched without regard for case.
The following is a full example config.json
.
{
"authentication": {
"discord": "REDACTED",
"airtable_key": "REDACTED",
"airtable_base": "REDACTED"
},
"channels": {
"exclude": [
"ignore-this-channel"
]
},
"rules": {
"excluding": [
"^HELLO!$"
]
},
"reactions": {
"success": "📥",
"repeat": "♻️",
"unknown": "❓",
"skynet": "❌",
"fishing": "🎣"
},
"triggers": {
"new_motto": [
"!motto$",
"Accurate[.,!] New motto\\?"
]
},
"should_reply": false,
"approval_reaction": "mottoapproval",
"approval_opt_in_role": "Motto Opt In",
"support_channel": "help",
"support_users1": {
"alice": "230968346794836789",
"bob": "3982390689364366"
}
}
The trigger phrases detailed below are the defaults. Any others for each trigger must be added as laid out above.
@MottoBotto
MottoBotto will always react with emoji, but can also be configured to react with a text message response. The defaults for both are as follows, although the emoji reactions can be changed in configuration:
- ⏳ MottoBotto is waiting for approval from the motto's author before adding the motto to the leaderboard. There is currently no corresponding text reply for this situation.
- 📥 MottoBotto added the nominated motto to the collection: "'Nominated-motto' will be considered!"
- ❓ MottoBotto does not know what you're responding to (i.e. the nominator has forgotten to reply to the motto they are nominating): "I see no motto!"
- ♻️ MottoBotto has previously added the nominated motto to the collection. There is currently no corresponding text reply for this situation.
- ❌ MottoBotto is either:
- 👽 not allowing itself to be nominated (i.e. the nominated message was written by MottoBotto): "Skynet prevention"
- 🎣 rejecting the motto for motto-fishing (i.e. the motto was written by the nominator): "Motto self-suggestions are forbidden"
- 🙅 rejecting the motto for violating at least one rule (e.g. the motto is shorter than two words, the motto @-mentions another user, etc.) There is currently no corresponding text reply for this situation.
- 🗑 not able to add the approved motto, as the message has since been deleted. There is currently no corresponding text reply for this situation.
!emoji
This trigger phrase must be sent as a direct message to MottoBotto. If followed by an emoji (such as !emoji 🚀
, it will set the user's emoji in the leaderboard to the specified emoji. If no emoji is specified, it will clear the emoji from the leaderboard for that user. It will only work for standard emoji, and not server-specific custom emoji.
MottoBotto will respond to the message with one of two reactions (the emoji for which can be changed in configuration). The defaults are as follows:
- ✅ The user's emoji was successfully updated.
⚠️ The emoji specified is not valid.
This code is copyright the contributors. The MottoBotto name was created by izzystardust.
MottoBotto is licensed under the Mozilla Public License 2.0
Robot and Scroll Emoji Copyright 2020 Twitter, Inc and other contributors and licensed under CC-BY 4.0