source: python-cinema-club-bot/commands/meta.py

Last change on this file was 23bddf3, checked in by Mikhail Kirillov <w96k@…>, on Oct 10, 2024 at 6:20:52 AM

Task #10. /announce command

  • Property mode set to 100644
File size: 1.1 KB
RevLine 
[cc34991]1# This file is part of python-cinema-club-bot
2# contributed in 2024 by Mikhail Kirillov (~w96k) <w96k@runbox.com>
3
4# To the extent possible under law, the author(s) have dedicated all copyright
5# and related and neighboring rights to this software to the public domain
6# worldwide. This software is distributed without any warranty.
7
8# You should have received a copy of the CC0 Public Domain Dedication along
9# with this software. If not, see:
10# <http://creativecommons.org/publicdomain/zero/1.0/>
11
12from telegram import Update
13from telegram.ext import ContextTypes
[23bddf3]14from subprocess import check_output
[cc34991]15
[23bddf3]16from strings import ABOUT
[cc34991]17
18
[23bddf3]19VERSION="0.1"
20
[cc34991]21
[23bddf3]22def _get_commit_hash() -> str:
23 return check_output(['git', 'rev-parse', 'HEAD']).decode('ascii').strip()
[cc34991]24
25
[23bddf3]26def _get_commit_short_hash() -> str:
27 return check_output(['git', 'rev-parse', '--short', 'HEAD']).decode('ascii').strip()
[cc34991]28
29
[23bddf3]30async def about(update: Update, context: ContextTypes.DEFAULT_TYPE) -> None:
31 await update.message.reply_text(
32 ABOUT.format(
33 version=VERSION,
34 commit=_get_commit_short_hash(),
35 )
36 )
Note: See TracBrowser for help on using the repository browser.