By Chris Angell aka Chris62vw
Below is a proposed design for an irc bot factoid database that supports fact aliasing and the locking of fact aliases and fact definitions. Every "factoid" is really an alias to a definition. A change to an alias' value actually changes the underlying definitions. An alias to another alias will be treated as an alias to a fact who has the same def_id as the target alias.
The database used is SQLite. SQLite is like perl in how it treats values as open containers, much like anything can be stored in a perl scalar. SQLite also ignores certain constraints, like primary and foreign keys. Visit the SQLite website for more information.
Key:
| alias_id | alias_name | alias_added_by | def_id | alias_locked |
|---|---|---|---|---|
| 1 | foo | Jim | 1 | 1 |
| 2 | fooey | Bob | 1 | 0 |
| 3 | bar | Rick | 2 | 1 |
Key:
| def_id | def_value | def_added_by | def_locked |
|---|---|---|---|
| 1 | A foo or fooey thing | Rick | 1 |
| 2 | A bar thing | Jim | 0 |
User levels will be used so alaises and definitions can be "locked" to prevent change. There will be five user levels:
The user levels will also be used for other things. For example, if someone is abusing the bot, he could be given a level 0 access level. Then the bot would ignore the user. User levels for the factiod database is simply the first step.
A "locked" alias can only be removed or changed depending on the user level of the user who is attempting to affect the change.
Key:
| alias_id | user_id | locked_level |
|---|---|---|
| 1 | 1001 | 2 |
| 3 | 1034 | 4 |
A "locked" definition can only be removed or changed depending on the user level of the user who is attempting to affect the change.
Key:
| def_id | user_id | locked_level |
|---|---|---|
| 1 | 1001 | 3 |