mirror of
https://github.com/lyx0/nourybot-matrix.git
synced 2024-11-13 19:49:54 +01:00
add phonetic explanation
This commit is contained in:
parent
665e6b95ea
commit
56fdcfc78e
2 changed files with 24 additions and 6 deletions
|
@ -62,6 +62,11 @@ func (app *Application) ParseCommand(evt *event.Event) {
|
||||||
}
|
}
|
||||||
|
|
||||||
case "phonetic":
|
case "phonetic":
|
||||||
|
if msgLen == 1 {
|
||||||
|
resp := commands.PhoneticExplanation()
|
||||||
|
app.SendText(evt, resp)
|
||||||
|
return
|
||||||
|
} else {
|
||||||
msg := evt.Content.AsMessage().Body[9:len(evt.Content.AsMessage().Body)]
|
msg := evt.Content.AsMessage().Body[9:len(evt.Content.AsMessage().Body)]
|
||||||
if resp, err := commands.Phonetic(msg); err != nil {
|
if resp, err := commands.Phonetic(msg); err != nil {
|
||||||
app.Log.Error().Err(err).Msg("failed to handle phonetic command")
|
app.Log.Error().Err(err).Msg("failed to handle phonetic command")
|
||||||
|
@ -71,6 +76,7 @@ func (app *Application) ParseCommand(evt *event.Event) {
|
||||||
app.SendText(evt, resp)
|
app.SendText(evt, resp)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
case "ping":
|
case "ping":
|
||||||
if resp, err := commands.Ping(); err != nil {
|
if resp, err := commands.Ping(); err != nil {
|
||||||
|
|
|
@ -73,6 +73,18 @@ var cm = map[string]string{
|
||||||
"M": "М",
|
"M": "М",
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func PhoneticExplanation() string {
|
||||||
|
// This might look like complete ass depending on the
|
||||||
|
// matrix clients font. Looks fine on my Element client.
|
||||||
|
help := `
|
||||||
|
| Ё | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | - | Ъ |
|
||||||
|
| Я | Ш | Е | Р | Т | Ы | У | И | О | П | Ю | Щ | Э |
|
||||||
|
| А | С | Д | Ф | Г | Ч | Й | К | Л | Ь | Ж |
|
||||||
|
| З | Х | Ц | В | Б | Н | М | ; | : |
|
||||||
|
`
|
||||||
|
return help
|
||||||
|
}
|
||||||
|
|
||||||
func Phonetic(message string) (string, error) {
|
func Phonetic(message string) (string, error) {
|
||||||
var ts string
|
var ts string
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue