|
11 | 11 | def analyze_message(message: str) -> Callable[[BaseClient], None]: |
12 | 12 | """コマンド解析""" |
13 | 13 |
|
14 | | - conditions = {'help': lambda m: hato.help_message, |
15 | | - 'eq': lambda m: hato.earth_quake, |
16 | | - '地震': lambda m: hato.earth_quake, |
17 | | - 'text list': lambda m: hato.get_text_list, |
18 | | - 'text add ': lambda m: partial(hato.add_text, word=m[len('text add '):]), |
19 | | - 'text show ': lambda m: partial(hato.show_text, power_word_id=m[len('text show '):]), |
20 | | - 'text delete ': lambda m: partial(hato.delete_text, power_word_id=m[len('text delete '):]), |
21 | | - 'text random': lambda m: hato.show_random_text, |
22 | | - 'text': lambda m: hato.show_random_text, |
23 | | - '>< ': lambda m: partial(hato.totuzensi, message=m[len('>< '):]), |
24 | | - 'amesh': lambda m: partial(hato.amesh, place=(m[len('amesh'):]).strip()), |
25 | | - '電力': lambda m: hato.electricity_demand, |
26 | | - '標高': lambda m: partial(hato.altitude, place=(m[len('標高'):]).strip()), |
27 | | - 'version': lambda m: hato.version, |
28 | | - 'にゃーん': lambda m: hato.yoshiyoshi, |
29 | | - 'おみくじ': lambda m: hato.omikuji, |
30 | | - } |
| 14 | + conditions = { |
| 15 | + 'help': lambda m: hato.help_message, |
| 16 | + 'eq': lambda m: hato.earth_quake, |
| 17 | + '地震': lambda m: hato.earth_quake, |
| 18 | + 'text list': lambda m: hato.get_text_list, |
| 19 | + 'text add ': lambda m: partial( |
| 20 | + hato.add_text, |
| 21 | + word=m[len('text add '):] |
| 22 | + ), |
| 23 | + 'text show ': lambda m: partial( |
| 24 | + hato.show_text, |
| 25 | + power_word_id=m[len('text show '):] |
| 26 | + ), |
| 27 | + 'text delete ': lambda m: partial( |
| 28 | + hato.delete_text, |
| 29 | + power_word_id=m[len('text delete '):] |
| 30 | + ), |
| 31 | + 'text random': lambda m: hato.show_random_text, |
| 32 | + 'text': lambda m: hato.show_random_text, |
| 33 | + '>< ': lambda m: partial(hato.totuzensi, message=m[len('>< '):]), |
| 34 | + 'amesh': lambda m: partial(hato.amesh, place=m[len('amesh'):].strip()), |
| 35 | + '電力': lambda m: hato.electricity_demand, |
| 36 | + '標高': lambda m: partial(hato.altitude, place=m[len('標高'):].strip()), |
| 37 | + 'version': lambda m: hato.version, |
| 38 | + 'にゃーん': lambda m: hato.yoshiyoshi, |
| 39 | + 'おみくじ': lambda m: hato.omikuji, |
| 40 | + } |
31 | 41 |
|
32 | 42 | for key, method in conditions.items(): |
33 | 43 | if message.startswith(key): |
|
0 commit comments