Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
Create free account
hub
/
github.com/H-T-H/Gemini-Telegram-Bot
/ functions
Functions
92 in github.com/H-T-H/Gemini-Telegram-Bot
⨍
Functions
92
◇
Types & classes
13
↓ 20 callers
Method
reply_to
(self, message, text, **kwargs)
tests/test_storage.py:200
↓ 12 callers
Function
_connect
()
src/storage.py:25
↓ 8 callers
Method
answer_callback_query
(self, callback_query_id, text=None, show_alert=None, **kwargs)
tests/test_storage.py:206
↓ 8 callers
Method
edit_message_text
(self, text, **kwargs)
tests/test_storage.py:209
↓ 6 callers
Function
ensure_authorized
(message: Message, bot: TeleBot)
src/handlers.py:64
↓ 6 callers
Function
is_admin
(user_id: int)
src/access_control.py:27
↓ 5 callers
Function
_now
()
src/storage.py:14
↓ 5 callers
Function
get_client
()
src/utils.py:43
↓ 5 callers
Function
init_user
if user not exist in chat_dict, create one Args: user_id: (int): user's id Returns: UserSession: user's chat session sta
src/utils.py:86
↓ 5 callers
Method
send_message
(self, chat_id, text, **kwargs)
tests/test_storage.py:203
↓ 5 callers
Function
send_model_picker
(message: Message, bot: TeleBot)
src/handlers.py:98
↓ 4 callers
Method
create
(self, model: str, history: list | None = None)
tests/test_storage.py:143
↓ 4 callers
Function
get_current_model
(user_id: int)
src/utils.py:132
↓ 3 callers
Function
get_access_subject
(message)
src/access_control.py:35
↓ 3 callers
Function
get_subject_access_status
(subject_type: str, subject_id: int)
src/access_control.py:39
↓ 3 callers
Function
get_user_error_message
(error: Exception)
src/gemini.py:16
↓ 2 callers
Function
are_access_requests_enabled
()
src/access_control.py:43
↓ 2 callers
Function
list_available_models
(force_refresh: bool = False)
src/utils.py:68
↓ 2 callers
Function
review_access
(subject_type: str, subject_id: int, status: str, reviewed_by: int)
src/access_control.py:80
↓ 1 callers
Function
_get_db_path
()
src/storage.py:18
↓ 1 callers
Function
_is_chat_model
(model_name: str, supported_actions: list[str])
src/utils.py:51
↓ 1 callers
Function
_normalize_contents_for_history
(contents: str | list[Any])
src/utils.py:157
↓ 1 callers
Function
_normalize_model_name
(model_name: str)
src/utils.py:48
↓ 1 callers
Function
build_access_markup
(subject_type: str, subject_id: int)
src/handlers.py:31
↓ 1 callers
Function
build_model_markup
(models: list[str])
src/handlers.py:92
↓ 1 callers
Function
build_revoke_markup
(subject_type: str, subject_id: int)
src/handlers.py:168
↓ 1 callers
Function
clear_history
clear user's history Args: user_id (int): user's id Returns: None
src/utils.py:136
↓ 1 callers
Function
format_access_request
(message: Message)
src/handlers.py:39
↓ 1 callers
Function
format_approved_access_record
(record: dict[str, object])
src/handlers.py:156
↓ 1 callers
Function
get_admin_user_ids
()
src/access_control.py:31
↓ 1 callers
Function
get_approved_access_records
()
src/access_control.py:88
↓ 1 callers
Function
get_setting
(key: str, default: str | None = None)
src/storage.py:222
↓ 1 callers
Function
init_admin_user_ids
(user_ids: str)
src/access_control.py:15
↓ 1 callers
Function
init_client
Initialize the Gemini client once during application startup.
src/utils.py:38
↓ 1 callers
Function
init_db
(path: str)
src/storage.py:38
↓ 1 callers
Function
is_subject_authorized
(subject_type: str, subject_id: int, actor_user_id: int)
src/access_control.py:51
↓ 1 callers
Function
is_user_authorized
(user_id: int)
src/access_control.py:57
↓ 1 callers
Function
main
()
src/main.py:34
↓ 1 callers
Function
notify_admins_access_request
(message: Message, bot: TeleBot)
src/handlers.py:52
↓ 1 callers
Function
request_access
(message)
src/access_control.py:63
↓ 1 callers
Function
revoke_access
(subject_type: str, subject_id: int, reviewed_by: int)
src/access_control.py:84
↓ 1 callers
Function
save_turn
(user_id: int, contents: str | list[Any], model_text: str)
src/utils.py:171
↓ 1 callers
Function
select_model
Select user's chat model, keeping history when a chat already exists. Args: user_id (int): user's id new_model (str): model t
src/utils.py:110
↓ 1 callers
Function
set_access_request_enabled
(enabled: bool)
src/access_control.py:47
↓ 1 callers
Function
set_setting
(key: str, value: str)
src/storage.py:233
Method
__init__
(self, model: str, history: list | None = None)
tests/test_storage.py:134
Method
__init__
( self, user_id: int, username: str | None = "user", first_name: str | None =
tests/test_storage.py:156
Method
__init__
(self, chat_id: int = 1, chat_type: str = "private", title: str | None = None)
tests/test_storage.py:170
Method
__init__
(self, user_id: int, chat_type: str = "private", chat_id: int = 1, title: str | None = None)
tests/test_storage.py:177
Method
__init__
(self, user_id: int, data: str)
tests/test_storage.py:183
Method
__init__
(self)
tests/test_storage.py:194
Function
_fetch_available_models
()
src/utils.py:58
Function
access
(message: Message, bot: TeleBot)
src/handlers.py:175
Function
access_callback
(call: CallbackQuery, bot: TeleBot)
src/handlers.py:225
Function
accessrequest
(message: Message, bot: TeleBot)
src/handlers.py:195
Function
append_turn
( user_id: int, model: str, user_text: str, model_text: str, max_turns: int | None = None,
src/storage.py:164
Method
asyncSetUp
(self)
tests/test_storage.py:214
Method
asyncTearDown
(self)
tests/test_storage.py:221
Function
clear
(message: Message, bot: TeleBot)
src/handlers.py:139
Function
clear_user_history
(user_id: int)
src/storage.py:217
Function
create_access_request
( subject_type: str, subject_id: int, username: str | None, first_name: str | None, last_n
src/storage.py:271
Function
gemini_handler
(message: Message, bot: TeleBot)
src/handlers.py:126
Function
gemini_photo_handler
(message: Message, bot: TeleBot)
src/handlers.py:278
Function
gemini_private_handler
(message: Message, bot: TeleBot)
src/handlers.py:269
Function
gemini_stream
(bot:TeleBot, message:Message, contents:str|list)
src/gemini.py:38
Function
get_access_requests_enabled
()
src/storage.py:248
Function
get_access_status
(subject_type: str, subject_id: int)
src/storage.py:256
Method
get_history
(self)
tests/test_storage.py:138
Function
get_user_model
(user_id: int)
src/storage.py:109
Function
list_approved_access
()
src/storage.py:380
Function
load_history
(user_id: int, limit_turns: int | None = None)
src/storage.py:135
Function
model
(message: Message, bot: TeleBot)
src/handlers.py:148
Function
model_callback
(call: CallbackQuery, bot: TeleBot)
src/handlers.py:205
Function
review_access_request
( subject_type: str, subject_id: int, status: str, reviewed_by: int, )
src/storage.py:347
Method
setUp
(self)
tests/test_storage.py:17
Function
set_access_requests_enabled
(enabled: bool)
src/storage.py:252
Function
set_user_model
(user_id: int, model: str)
src/storage.py:120
Function
start
(message: Message, bot: TeleBot)
src/handlers.py:116
Method
tearDown
(self)
tests/test_storage.py:22
Method
test_access_list_is_admin_only_and_revoke_is_protected
(self)
tests/test_storage.py:318
Method
test_access_request_and_admin_review_flow
(self)
tests/test_storage.py:261
Method
test_access_request_lifecycle
(self)
tests/test_storage.py:61
Method
test_access_request_setting_defaults_to_enabled
(self)
tests/test_storage.py:123
Method
test_access_request_switch_is_admin_only
(self)
tests/test_storage.py:340
Method
test_approved_list_only_returns_users
(self)
tests/test_storage.py:98
Method
test_existing_pending_request_still_reports_when_switch_is_closed
(self)
tests/test_storage.py:367
Method
test_generic_error_uses_default_message
(self)
tests/test_gemini_errors.py:30
Method
test_group_access_is_checked_by_user_id
(self)
tests/test_storage.py:300
Method
test_model_history_trim_and_clear
(self)
tests/test_storage.py:25
Method
test_quota_error_is_sanitized
(self)
tests/test_gemini_errors.py:13
Method
test_rejected_user_is_not_resubmitted
(self)
tests/test_storage.py:288
Method
test_restore_switch_clear_and_image_summary
(self)
tests/test_storage.py:227