Skip to content

Instantly share code, notes, and snippets.

@borntyping
Created January 15, 2012 16:44
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save borntyping/1616378 to your computer and use it in GitHub Desktop.
Save borntyping/1616378 to your computer and use it in GitHub Desktop.
Design for Tactics irc bot
Instructions
- Restricted commands may only be done by admins, on quotes that belong to the user or on quotes about the user
- Gender
- Set gender: Set the users gender in the database
- "(?=I am|My gender is) (male|female|androgynous)", "Refer to me (by name|randomly)", "Refer to me with <list of five pronouns>"
- "{nick}: I am no refering to you with the pronouns <list of five pronouns>"
- Get gender: Ask the bot if the user has get a gender
- "What is my gender?", "What gender is (?P<person>.+)?
- "You are {gender}", "Person is {gender}"
- Aliases
- Set an alias
- "[\"'](?P<x>.+)[\"'] means [\"'](?P<y>.+)[\"']"
- "{x} now means {y}."
- !duplicate
- Remove an alias
- "Remove alias (?P<id>.+)"
- "{x} has been removed."
- !notfound, !locked
- Phrases
- Create: add a phrase to the database
- ~links
- "I have added that to the collection. #{id}"
- !duplicate
- Edit: edit the phrase by applying a regex to the text (Restricted)
- "apply s/(.+)/(.+)/ to #(?P<id>)"
- "I have edited that phrase. #{id}"
- !notfound, !locked
- Delete: remove the phrase from the db (Restricted)
- !notfound, !locked
- Lock, Unlock: only users can edit the phrase if this is set
- "lock #(?P<id>) user"
- "I have locked phrase #{id} to users only.", "I have unlocked phrase #{id}"
- !locked
- Admin
- Ban, Unban
- "ban (?P<user>.+)", "unban (?P<user>.+)"
- "User {user} was (un)banned."
- Restrict, Unrestrict
- "restrict (?P<user>.+)", "restrict (?P<user>.+)"
- "User {user} was (un)restrict."
- Lock, Unlock: only admins can edit the phrase if this is set
- "lock #(?P<id>) admin"
- "I have locked phrase #{id} to admins only.", "I have unlocked phrase #{id}"
- !locked
Recall
- Return quote from message
- Assemble quote
- Format quote with variables
- People
- {user} - Nick that triggered the phrase
- {person} - Person that is the subject of the quote
- {someone} - Random person in the channel
- {admin} - One of the bot admins
- Gender - if a person variable is in the quote, look up genders (and other info?) for them
- {gender.<type>}
- subjective
- objective
- reflexive
- possessive
- determiner
Static data
- links
- type: (input, output)
- data = dict(
'is': ("(?P<subject>.+) is (?P<phrase>.+)", "{subject} is {phrase}"),
'are': ("(?P<subject>.+) are (?P<phrase>.+)", "{subject} are {phrase}"),
'owns': ("(?P<subject>.+)'s (?P<phrase>.+)", "{subject}'s {phrase}"),
'verb': ("(?P<subject>.+) *(?P<verb>.+)* (?P<phrase>.+)", "{subject} {verb} {phrase}"),
'reply': ("(?P<subject>.+) <reply> (?P<phrase>.+)", "{phrase}"),
'error': ("(?P<subject>.+) <error> (?P<phrase>.+)", "{phrase}"),
'special': ("(?P<subject>.+) <special> (?P<phrase>.+)", "\001ACTION{phrase}\001"),
)
- locked
- 'admin': Can only be edited by an admin
- 'owner': Can only be edited by the owner
- None: Can be edited by all
- error: Error/special messages
- '!notfound': A phrase could not be found
- '!locked': The phrase was locked (could not be edited or deleted)
- '!duplicate': The phrase was already in the collection for that subject
Flags
- 'admin': The user may use admin functions
- 'banned': User may not interact with the bot
- 'restricted': User may not use instructions
Database
- aliases
- Contains aliases for phrases, genders and people. 'x means y'
- "_id" is indexed, unique
- {"_id": x, "y": y, "lock": ~locked}
- phrases
- Contains phrases
- indexed by 'lc_subject'
- {lc_subject, subject, link: ~link, text[, verb [, meta: {author: hostmask, time-created, [time-edited[, "lock": ~locked]]}]]}
- gender
- Contains information on genders and their pronouns
- {"_id": name, subjective, objective, reflexive, possessive, determiner}
- "_id" is indexed, unique
- data
male: he, him, himself, his, his
female: she, her, herself, hers, her
androgynous: they, them, themself, theirs, their
non-binary: zie, hir, hirself, hirs, hir
inanimate: it, it, itself, its, its
name: {name}, {name}, {name}, {name}'s, {name}'s
random: refer to user using the pronouns a gender randomly selected from (male, female, non-binary)
- people
- {"_id": nickname, (gender: ~gender) || pronouns: {}), "flags": ~flags}
- "_id" is indexed, unique
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment