Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inserted Porto Velho TimeZone #3

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
manaus = pytz.timezone("America/Manaus")
belem = pytz.timezone("America/Belem")
rio_branco = pytz.timezone("America/Rio_Branco")
porto_velho = pytz.timezone("America/Porto_Velho")
bruxelas = pytz.timezone("Europe/Brussels")
palmas = pytz.timezone("America/Araguaina")

Expand Down Expand Up @@ -262,7 +263,7 @@ def eventos_gera_lista(message):
if eventos:
mensagem = []
for evento in eventos:
m, b, r = traduza_hora(evento)
m, b, r = traduza_hora(evento)
mensagem.append(EVENTOS_LISTA_ADMIN.format(evento, r, m, b))
mensagem = "\n".join(mensagem)
else:
Expand Down Expand Up @@ -298,7 +299,7 @@ def eventos_edita(message, comandos):
if subcomando in ["data", "hora"]:
base = evento.data
if subcomando == "data":
data = datetime.strptime(comandos[4], "%Y-%m-%d" )
data = datetime.strptime(comandos[4], "%Y-%m-%d")
base = datetime.combine(data.date(), base.time())
if subcomando == "hora":
horas, minutos = [int(x) for x in comandos[4].split(":")]
Expand All @@ -309,6 +310,7 @@ def eventos_edita(message, comandos):
db.edita_evento(id, **{subcomando: comandos[4], "telegram": message.from_user.id})
envia_evento(message, db.get_evento_admin(id))


def eventos_apaga(message, comandos):
if len(comandos) != 3:
bot_responda(mensage, AJUDA_EVENTO_APAGA)
Expand All @@ -328,7 +330,7 @@ def eventos_cria(message, comandos):
return
dia = comandos[2]
hora = comandos[3]
data = datetime.strptime("{} {}".format(dia, hora), "%Y-%m-%d %H:%M" )
data = datetime.strptime("{} {}".format(dia, hora), "%Y-%m-%d %H:%M")
descricao = comandos[4]
link = comandos[5]

Expand Down Expand Up @@ -380,16 +382,19 @@ def send_hora(message):
"belem": belem.normalize(agora),
"riobranco": rio_branco.normalize(agora),
"palmas": palmas.normalize(agora),
"portovelho": porto_velho.normalize(agora),
"bruxelas": bruxelas.normalize(agora)
}
bot_responda(message, HORA.format(**horarios))


@bot.message_handler(commands=['versão', 'versao'])
def versao(message):
if protecao_spam_do_grupo(message, "versao"):
return
bot_responda(message, "Versão: {}".format(VERSAO))


# Principal
_logger = telebot.logger
telebot.logger.setLevel(logging.DEBUG)
Expand Down