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

Update main.py #11

Open
wants to merge 5 commits into
base: gh-wf
Choose a base branch
from
Open
Show file tree
Hide file tree
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
32 changes: 32 additions & 0 deletions .github/workflows/manual.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# This is a basic workflow that is manually triggered

name: Manual workflow

# Controls when the action will run. Workflow runs when manually triggered using the UI
# or API.
on:
workflow_dispatch:
# Inputs the workflow accepts.
inputs:
name:
# Friendly description to be shown in the UI instead of 'name'
description: 'Person to greet'
# Default value if no value is explicitly provided
default: 'World'
# Input has to be provided for the workflow to run
required: true
# The data type of the input
type: string

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "greet"
greet:
# The type of runner that the job will run on
runs-on: ubuntu-latest

# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Runs a single command using the runners shell
- name: Send greeting
run: echo "Hello ${{ inputs.name }}"
2 changes: 1 addition & 1 deletion .github/workflows/updater.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: ⚡️ Update Status. ⚡️
name: Update Status. ⚡️

on:
schedule:
Expand Down
14 changes: 7 additions & 7 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
LIST_BOTS = config("BOTS")
CHANNEL_ID = config("CHANNEL_ID", cast=int)
MESSAGE_ID = config("MESSAGE_ID", cast=int)
CHANNEL_NAME = config("CHANNEL_NAME", default="@BotzHub")
CHANNEL_NAME = config("CHANNEL_NAME", default="@zooistore")
TIME_ZONE = config("TIME_ZONE", default="Asia/Kolkata")
except BaseException as ex:
log.info(ex)
Expand All @@ -50,7 +50,7 @@ async def check_bots():
log.info("[CHECK] Started periodic checks...")
channel_current_msg = await client.get_messages(CHANNEL_ID, ids=MESSAGE_ID)
new_message = (
"⚠️ **New periodic check in progress...** ⚠️\n\n" + channel_current_msg.text
"⚠️ **New check in progress...** ⚠️\n\n" + channel_current_msg.text
)
try:
await client.edit_message(CHANNEL_ID, MESSAGE_ID, new_message)
Expand Down Expand Up @@ -80,7 +80,7 @@ async def check_bots():
# save stats in a dict
bot_stats[bot] = {
"response_time": None,
"status": "",
"status": "☠︎︎",
}
else:
time_after_sending = time.time()
Expand All @@ -89,12 +89,12 @@ async def check_bots():
# save stats in a dict.
bot_stats[bot] = {
"response_time": f"`{round(time_taken_for_response * 1000, 3)}ms`", # convert to ms for readability
"status": "",
"status": "✔︎",
}
except BaseException:
bot_stats[bot] = {
"response_time": "",
"status": "",
"status": "☠︎︎",
}
await client.send_read_acknowledge(bot)
log.info(f"[CHECK] Checked @{bot} - {bot_stats[bot]['status']}.")
Expand Down Expand Up @@ -134,10 +134,10 @@ async def check_bots():
# add last checked time
current_time_utc = datetime.datetime.now(pytz.utc)
current_time = current_time_utc.astimezone(pytz.timezone(TIME_ZONE))
status_message += f"**Last checked at** `{current_time.strftime('%H:%M:%S - %d %B %Y')}` [ __{TIME_ZONE}__ ]"
status_message += f"➪ Lᴀsᴛ Cʜᴇᴄᴋᴇᴅ Aᴛ `{current_time.strftime('%H:%M:%S - %d %B %Y')}` [ __{TIME_ZONE}__ ]"

# add auto check message
status_message += f"\n\n**This message will be updated every 2 hours.**"
status_message += f"\n\n𝖡𝗈𝗍 𝖶𝗂𝗅𝗅 𝖢𝗁𝖾𝖼𝗄𝖾𝖽 𝖤𝗏𝖾𝗋𝗒 2 𝖧𝗈𝗎𝗋𝗌♲︎︎︎"

# edit the message in the channel
try:
Expand Down