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

Implementa o sensor de presença novamente #8

Open
wants to merge 2 commits into
base: main
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
10 changes: 8 additions & 2 deletions src/joker/commands/status.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,18 @@


async def status(update, context):
response = httpx.get("https://lhc.net.br/spacenet.json?whois").json()
status = f'aberto com {response["n_known_macs"]} pessoas associadas' if response["n_known_macs"] else 'fechado'
if response["n_unknown_macs"]:
desconhecidos = f'mais {response["n_unknown_macs"]} maritacas' if response["n_unknown_macs"] > 1 else 'mais uma maritaca solitária'
else:
desconhecidos = ''

await context.bot.send_message(
update.message.chat_id,
text="O LHC pode estar aberto \U0001F513 ou fechado \U0001F512. Eu não consegui descobrir.",
text=f"O LHC está {status}{desconhecidos} desde {response['last_change']}",
)


async def quem(update, context):
await context.bot.send_message(
update.message.chat_id,
Expand Down