MCPcopy
hub / github.com/father-bot/chatgpt_telegram_bot / set_user_attribute

Method set_user_attribute

bot/database.py:92–94  ·  view source on GitHub ↗
(self, user_id: int, key: str, value: Any)

Source from the content-addressed store, hash-verified

90 return user_dict[key]
91
92 def set_user_attribute(self, user_id: int, key: str, value: Any):
93 self.check_if_user_exists(user_id, raise_exception=True)
94 self.user_collection.update_one({"_id": user_id}, {"$set": {key: value}})
95
96 def update_n_used_tokens(self, user_id: int, model: str, n_input_tokens: int, n_output_tokens: int):
97 n_used_tokens_dict = self.get_user_attribute(user_id, "n_used_tokens")

Callers 15

update_n_used_tokensMethod · 0.95
start_handleFunction · 0.80
help_handleFunction · 0.80
help_group_chat_handleFunction · 0.80
retry_handleFunction · 0.80
message_handle_fnFunction · 0.80
message_handleFunction · 0.80
voice_message_handleFunction · 0.80
generate_image_handleFunction · 0.80
new_dialog_handleFunction · 0.80

Calls 1

check_if_user_existsMethod · 0.95

Tested by

no test coverage detected