Added help
This commit is contained in:
pare
009580868b
commit
207635cd17
S'han modificat 5 arxius amb 88 adicions i 4 eliminacions
|
@ -4,6 +4,10 @@ Mastodon Chess (mastochess) uses [python-chess](https://python-chess.readthedocs
|
||||||
|
|
||||||
### How to play:
|
### How to play:
|
||||||
|
|
||||||
|
To get help:
|
||||||
|
|
||||||
|
@your_bot_username help
|
||||||
|
|
||||||
To start a game:
|
To start a game:
|
||||||
|
|
||||||
@your_bot_username new
|
@your_bot_username new
|
||||||
|
@ -72,3 +76,4 @@ Within Python Virtual Environment:
|
||||||
27.11.2020 - New feature! Pawn promotion and locales support ( ca & eng )
|
27.11.2020 - New feature! Pawn promotion and locales support ( ca & eng )
|
||||||
28.11.2020 - New feature! Added 'es' locale support
|
28.11.2020 - New feature! Added 'es' locale support
|
||||||
28.11.2020 - New feature! Now any fediverse user can play Mastodon Chess!
|
28.11.2020 - New feature! Now any fediverse user can play Mastodon Chess!
|
||||||
|
28.11.2020 - New feature! Added help
|
||||||
|
|
|
@ -3,6 +3,7 @@ search_move: mou
|
||||||
search_new: nova
|
search_new: nova
|
||||||
search_games: jocs
|
search_games: jocs
|
||||||
search_send: envia
|
search_send: envia
|
||||||
|
search_help: ajuda
|
||||||
new_game_started: partida iniciada! Esperant jugador...
|
new_game_started: partida iniciada! Esperant jugador...
|
||||||
playing_with: jugues amb
|
playing_with: jugues amb
|
||||||
your_turn: el teu torn
|
your_turn: el teu torn
|
||||||
|
@ -47,3 +48,11 @@ rook_piece_letter: T
|
||||||
queen_piece_letter: D
|
queen_piece_letter: D
|
||||||
king_piece_letter: R
|
king_piece_letter: R
|
||||||
email_subject: Anotacions partida n.
|
email_subject: Anotacions partida n.
|
||||||
|
start_or_join_a_new_game: nova (iniciar partida o unirse a una en espera)
|
||||||
|
move_a_piece: mou e2e3 (per exemple)
|
||||||
|
leave_a_game: fi (per a deixar la partida en qualsevol moment)
|
||||||
|
list_games: jocs (mostra un llistat de partides actives)
|
||||||
|
get_a_game_anotation: envia 1 (1 és el número de la partida. Envia les anotacions de la partida per correu electrònic, només usuaris del servidor local)
|
||||||
|
show_help: ajuda (mostra aquesta ajuda i, per tant, és l'ajuda de l'ajuda)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -3,6 +3,7 @@ search_move: move
|
||||||
search_new: new
|
search_new: new
|
||||||
search_games: games
|
search_games: games
|
||||||
search_send: send
|
search_send: send
|
||||||
|
search_help: help
|
||||||
new_game_started: game started! Waiting for the second player...
|
new_game_started: game started! Waiting for the second player...
|
||||||
playing_with: you play with
|
playing_with: you play with
|
||||||
your_turn: it's your turn
|
your_turn: it's your turn
|
||||||
|
@ -47,3 +48,11 @@ rook_piece_letter: R
|
||||||
queen_piece_letter: Q
|
queen_piece_letter: Q
|
||||||
king_piece_letter: K
|
king_piece_letter: K
|
||||||
email_subject: Anotations of game n.
|
email_subject: Anotations of game n.
|
||||||
|
start_or_join_a_new_game: new (start a new game or join a waiting one)
|
||||||
|
move_a_piece: move e2e3 (in ex.)
|
||||||
|
leave_a_game: end (to leave the game any time)
|
||||||
|
list_games: games (show an on going games list)
|
||||||
|
get_a_game_anotation: send 1 (1 is the game number. It send the game's anotations by email but local users only)
|
||||||
|
show_help: help (show this help so, it's the help of the help)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -3,6 +3,7 @@ search_move: mueve
|
||||||
search_new: nueva
|
search_new: nueva
|
||||||
search_games: partidas
|
search_games: partidas
|
||||||
search_send: envia
|
search_send: envia
|
||||||
|
search_help: ayuda
|
||||||
new_game_started: partida iniciada! Esperando jugador...
|
new_game_started: partida iniciada! Esperando jugador...
|
||||||
playing_with: juegas con
|
playing_with: juegas con
|
||||||
your_turn: tu turno
|
your_turn: tu turno
|
||||||
|
@ -47,3 +48,11 @@ rook_piece_letter: T
|
||||||
queen_piece_letter: D
|
queen_piece_letter: D
|
||||||
king_piece_letter: R
|
king_piece_letter: R
|
||||||
email_subject: Anotaciones partida n.
|
email_subject: Anotaciones partida n.
|
||||||
|
start_or_join_a_new_game: nueva (empezar una partida o unirse a una en espera)
|
||||||
|
move_a_piece: mueve e2e3 (por ejemplo)
|
||||||
|
leave_a_game: fin (para dejar la partida en cualquier momento)
|
||||||
|
list_games: partidas (muestra un listado de partidas activas)
|
||||||
|
get_a_game_anotation: envia 1 (1 es el número de la partida. Envia las anotaciones de la partida pedida por correo electrónico pero sólo a usuarios del servidor local)
|
||||||
|
show_help: ayuda (muestra esta ayuda y, por tanto, es la ayuda de la ayuda)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -167,7 +167,7 @@ def get_notification_data():
|
||||||
|
|
||||||
url_lst = []
|
url_lst = []
|
||||||
|
|
||||||
search_text = [search_end, search_move, search_new, search_games, search_send]
|
search_text = [search_end, search_move, search_new, search_games, search_send, search_help]
|
||||||
|
|
||||||
conn = None
|
conn = None
|
||||||
|
|
||||||
|
@ -964,6 +964,24 @@ def next_move(playing_user):
|
||||||
|
|
||||||
conn.close()
|
conn.close()
|
||||||
|
|
||||||
|
def toot_help():
|
||||||
|
|
||||||
|
help_text = '@'+username + ' ' + search_help + ':\n'
|
||||||
|
help_text += '\n'
|
||||||
|
help_text += '@'+bot_username + ' ' + start_or_join_a_new_game + '\n'
|
||||||
|
help_text += '\n'
|
||||||
|
help_text += '@'+bot_username + ' ' + move_a_piece + '\n'
|
||||||
|
help_text += '\n'
|
||||||
|
help_text += '@'+bot_username + ' ' + leave_a_game + '\n'
|
||||||
|
help_text += '\n'
|
||||||
|
help_text += '@'+bot_username + ' ' + list_games + '\n'
|
||||||
|
help_text += '\n'
|
||||||
|
help_text += '@'+bot_username + ' ' + get_a_game_anotation + '\n'
|
||||||
|
help_text += '\n'
|
||||||
|
help_text += '@'+bot_username + ' ' + show_help + '\n'
|
||||||
|
|
||||||
|
return help_text
|
||||||
|
|
||||||
def replying():
|
def replying():
|
||||||
|
|
||||||
reply = False
|
reply = False
|
||||||
|
@ -1019,6 +1037,10 @@ def replying():
|
||||||
|
|
||||||
reply = True
|
reply = True
|
||||||
|
|
||||||
|
elif query_word == search_help:
|
||||||
|
|
||||||
|
reply = True
|
||||||
|
|
||||||
else:
|
else:
|
||||||
|
|
||||||
reply = False
|
reply = False
|
||||||
|
@ -1036,6 +1058,7 @@ def load_strings(bot_lang):
|
||||||
search_new = get_parameter("search_new", language_filepath)
|
search_new = get_parameter("search_new", language_filepath)
|
||||||
search_games = get_parameter("search_games", language_filepath)
|
search_games = get_parameter("search_games", language_filepath)
|
||||||
search_send = get_parameter("search_send", language_filepath)
|
search_send = get_parameter("search_send", language_filepath)
|
||||||
|
search_help = get_parameter("search_help", language_filepath)
|
||||||
new_game_started = get_parameter("new_game_started", language_filepath)
|
new_game_started = get_parameter("new_game_started", language_filepath)
|
||||||
playing_with = get_parameter("playing_with", language_filepath)
|
playing_with = get_parameter("playing_with", language_filepath)
|
||||||
your_turn = get_parameter("your_turn", language_filepath)
|
your_turn = get_parameter("your_turn", language_filepath)
|
||||||
|
@ -1043,7 +1066,7 @@ def load_strings(bot_lang):
|
||||||
chess_hashtag = get_parameter("chess_hashtag", language_filepath)
|
chess_hashtag = get_parameter("chess_hashtag", language_filepath)
|
||||||
send_error = get_parameter("send_error", language_filepath)
|
send_error = get_parameter("send_error", language_filepath)
|
||||||
|
|
||||||
return (search_end, search_move, search_new, search_games, search_send, new_game_started, playing_with, your_turn, game_name, chess_hashtag, send_error)
|
return (search_end, search_move, search_new, search_games, search_send, search_help, new_game_started, playing_with, your_turn, game_name, chess_hashtag, send_error)
|
||||||
|
|
||||||
def load_strings1(bot_lang):
|
def load_strings1(bot_lang):
|
||||||
|
|
||||||
|
@ -1108,6 +1131,17 @@ def load_strings5(bot_lang):
|
||||||
|
|
||||||
return (pawn_piece_letter, knight_piece_letter, bishop_piece_letter, rook_piece_letter, queen_piece_letter, king_piece_letter, email_subject)
|
return (pawn_piece_letter, knight_piece_letter, bishop_piece_letter, rook_piece_letter, queen_piece_letter, king_piece_letter, email_subject)
|
||||||
|
|
||||||
|
def load_strings6(bot_lang):
|
||||||
|
|
||||||
|
start_or_join_a_new_game = get_parameter("start_or_join_a_new_game", language_filepath)
|
||||||
|
move_a_piece = get_parameter("move_a_piece", language_filepath)
|
||||||
|
leave_a_game = get_parameter("leave_a_game", language_filepath)
|
||||||
|
list_games = get_parameter("list_games", language_filepath)
|
||||||
|
get_a_game_anotation = get_parameter("get_a_game_anotation", language_filepath)
|
||||||
|
show_help = get_parameter("show_help", language_filepath)
|
||||||
|
|
||||||
|
return (start_or_join_a_new_game, move_a_piece, leave_a_game, list_games, get_a_game_anotation, show_help)
|
||||||
|
|
||||||
def mastodon():
|
def mastodon():
|
||||||
|
|
||||||
# Load secrets from secrets file
|
# Load secrets from secrets file
|
||||||
|
@ -1244,7 +1278,7 @@ if __name__ == '__main__':
|
||||||
search_send_slicing = 5
|
search_send_slicing = 5
|
||||||
send_game_slicing = 6
|
send_game_slicing = 6
|
||||||
|
|
||||||
search_end, search_move, search_new, search_games, search_send, new_game_started, playing_with, your_turn, game_name, chess_hashtag, send_error = load_strings(bot_lang)
|
search_end, search_move, search_new, search_games, search_send, search_help, new_game_started, playing_with, your_turn, game_name, chess_hashtag, send_error = load_strings(bot_lang)
|
||||||
|
|
||||||
game_number_anotations, anotations_sent, game_no_exists, cant_send_to_fediverse_account, it_not_exists, game_already_started, wait_other_player, is_not_legal_move, check_done, check_mate = load_strings1(bot_lang)
|
game_number_anotations, anotations_sent, game_no_exists, cant_send_to_fediverse_account, it_not_exists, game_already_started, wait_other_player, is_not_legal_move, check_done, check_mate = load_strings1(bot_lang)
|
||||||
|
|
||||||
|
@ -1256,6 +1290,8 @@ if __name__ == '__main__':
|
||||||
|
|
||||||
pawn_piece_letter, knight_piece_letter, bishop_piece_letter, rook_piece_letter, queen_piece_letter, king_piece_letter, email_subject = load_strings5(bot_lang)
|
pawn_piece_letter, knight_piece_letter, bishop_piece_letter, rook_piece_letter, queen_piece_letter, king_piece_letter, email_subject = load_strings5(bot_lang)
|
||||||
|
|
||||||
|
start_or_join_a_new_game, move_a_piece, leave_a_game, list_games, get_a_game_anotation, show_help = load_strings6(bot_lang)
|
||||||
|
|
||||||
mastodon, mastodon_hostname, bot_username = mastodon()
|
mastodon, mastodon_hostname, bot_username = mastodon()
|
||||||
|
|
||||||
mastodon_db, mastodon_db_user, chess_db, chess_db_user = db_config()
|
mastodon_db, mastodon_db_user, chess_db, chess_db_user = db_config()
|
||||||
|
@ -1411,6 +1447,14 @@ if __name__ == '__main__':
|
||||||
|
|
||||||
update_replies(status_id, username, now)
|
update_replies(status_id, username, now)
|
||||||
|
|
||||||
|
elif query_word == search_help:
|
||||||
|
|
||||||
|
help_text = toot_help()
|
||||||
|
|
||||||
|
mastodon.status_post(help_text, in_reply_to_id=status_id,visibility=visibility)
|
||||||
|
|
||||||
|
update_replies(status_id, username, now)
|
||||||
|
|
||||||
else:
|
else:
|
||||||
|
|
||||||
update_replies(status_id, username, now)
|
update_replies(status_id, username, now)
|
||||||
|
@ -1746,6 +1790,14 @@ if __name__ == '__main__':
|
||||||
|
|
||||||
update_replies(status_id, username, now)
|
update_replies(status_id, username, now)
|
||||||
|
|
||||||
|
elif query_word == search_help:
|
||||||
|
|
||||||
|
help_text = toot_help()
|
||||||
|
|
||||||
|
mastodon.status_post(help_text, in_reply_to_id=status_id,visibility=visibility)
|
||||||
|
|
||||||
|
update_replies(status_id, username, now)
|
||||||
|
|
||||||
else:
|
else:
|
||||||
|
|
||||||
if playing_user == None:
|
if playing_user == None:
|
||||||
|
|
Loading…
Referencia en una nova incidència