Changeset 416:919e547ea0c9
- Timestamp:
- 06/21/2010 05:12:02 PM (20 months ago)
- Author:
- Sidgyck <sidgyck@…>
- Branch:
- default
- Message:
-
[NEW]: "!misc decide [choice 1] [choice 2] ... [choice n]" make a decision for you
- Files:
-
Legend:
- Unmodified
- Added
- Removed
-
|
r392
|
r416
|
|
| 12 | 12 | BasePlugin(parent) |
| 13 | 13 | { |
| 14 | | commands << "TEST" << "DATE" << "TIME" << "SAY"; |
| | 14 | commands << "TEST" << "DATE" << "TIME" << "SAY" << "DECIDE"; |
| 15 | 15 | |
| 16 | 16 | sayJidDisabled_=DataStorage::instance()->getInt("cmd/disable_misc_sayjid"); |
| … |
… |
|
| 78 | 78 | return true; |
| 79 | 79 | } |
| | 80 | if (cmd=="DECIDE") |
| | 81 | { |
| | 82 | QStringList choices = parser.getTokens(); |
| | 83 | if (choices.count() <= 3) |
| | 84 | { |
| | 85 | reply(s, "You have no choice."); |
| | 86 | return true; |
| | 87 | } |
| | 88 | srand( time(NULL) ); |
| | 89 | int r = random() % (choices.count()-2); // strip misc and decide tokens |
| | 90 | reply(s, choices[r+2]); |
| | 91 | return true; |
| | 92 | } |
| 80 | 93 | return false; |
| 81 | 94 | } |