|
20 | 20 | """This module contains an object that represents a Telegram User."""
|
21 | 21 |
|
22 | 22 | from telegram import TelegramObject
|
23 |
| -from telegram.utils.helpers import mention_markdown as util_mention_markdown |
24 | 23 | from telegram.utils.helpers import mention_html as util_mention_html
|
| 24 | +from telegram.utils.helpers import mention_markdown as util_mention_markdown |
25 | 25 |
|
26 | 26 |
|
27 | 27 | class User(TelegramObject):
|
@@ -146,3 +146,107 @@ def mention_html(self, name=None):
|
146 | 146 | return util_mention_html(self.id, self.name)
|
147 | 147 | else:
|
148 | 148 | return util_mention_html(self.id, name)
|
| 149 | + |
| 150 | + def send_message(self, *args, **kwargs): |
| 151 | + """Shortcut for:: |
| 152 | +
|
| 153 | + bot.send_message(User.chat_id, *args, **kwargs) |
| 154 | +
|
| 155 | + Where User is the current instance. |
| 156 | +
|
| 157 | + Returns: |
| 158 | + :class:`telegram.Message`: On success, instance representing the message posted. |
| 159 | +
|
| 160 | + """ |
| 161 | + return self.send_message(chat_id=self.id, *args, **kwargs) |
| 162 | + |
| 163 | + def send_photo(self, *args, **kwargs): |
| 164 | + """Shortcut for:: |
| 165 | +
|
| 166 | + bot.send_photo(User.chat_id, *args, **kwargs) |
| 167 | +
|
| 168 | + Where User is the current instance. |
| 169 | +
|
| 170 | + Returns: |
| 171 | + :class:`telegram.Message`: On success, instance representing the message posted. |
| 172 | +
|
| 173 | + """ |
| 174 | + return self.send_photo(chat_id=self.id, *args, **kwargs) |
| 175 | + |
| 176 | + def send_audio(self, *args, **kwargs): |
| 177 | + """Shortcut for:: |
| 178 | +
|
| 179 | + bot.send_audio(User.chat_id, *args, **kwargs) |
| 180 | +
|
| 181 | + Where User is the current instance. |
| 182 | +
|
| 183 | + Returns: |
| 184 | + :class:`telegram.Message`: On success, instance representing the message posted. |
| 185 | +
|
| 186 | + """ |
| 187 | + return self.send_audio(chat_id=self.id, *args, **kwargs) |
| 188 | + |
| 189 | + def send_document(self, *args, **kwargs): |
| 190 | + """Shortcut for:: |
| 191 | +
|
| 192 | + bot.send_document(User.chat_id, *args, **kwargs) |
| 193 | +
|
| 194 | + Where User is the current instance. |
| 195 | +
|
| 196 | + Returns: |
| 197 | + :class:`telegram.Message`: On success, instance representing the message posted. |
| 198 | +
|
| 199 | + """ |
| 200 | + return self.send_document(chat_id=self.id, *args, **kwargs) |
| 201 | + |
| 202 | + def send_sticker(self, *args, **kwargs): |
| 203 | + """Shortcut for:: |
| 204 | +
|
| 205 | + bot.send_sticker(User.chat_id, *args, **kwargs) |
| 206 | +
|
| 207 | + Where User is the current instance. |
| 208 | +
|
| 209 | + Returns: |
| 210 | + :class:`telegram.Message`: On success, instance representing the message posted. |
| 211 | +
|
| 212 | + """ |
| 213 | + return self.send_sticker(chat_id=self.id, *args, **kwargs) |
| 214 | + |
| 215 | + def send_video(self, *args, **kwargs): |
| 216 | + """Shortcut for:: |
| 217 | +
|
| 218 | + bot.send_video(User.chat_id, *args, **kwargs) |
| 219 | +
|
| 220 | + Where User is the current instance. |
| 221 | +
|
| 222 | + Returns: |
| 223 | + :class:`telegram.Message`: On success, instance representing the message posted. |
| 224 | +
|
| 225 | + """ |
| 226 | + return self.send_video(chat_id=self.id, *args, **kwargs) |
| 227 | + |
| 228 | + def send_video_note(self, *args, **kwargs): |
| 229 | + """Shortcut for:: |
| 230 | +
|
| 231 | + bot.send_video_note(User.chat_id, *args, **kwargs) |
| 232 | +
|
| 233 | + Where User is the current instance. |
| 234 | +
|
| 235 | + Returns: |
| 236 | + :class:`telegram.Message`: On success, instance representing the message posted. |
| 237 | +
|
| 238 | + """ |
| 239 | + return self.send_video_note(chat_id=self.id, *args, **kwargs) |
| 240 | + |
| 241 | + def send_voice(self, *args, **kwargs): |
| 242 | + """Shortcut for:: |
| 243 | +
|
| 244 | + bot.send_voice(User.chat_id, *args, **kwargs) |
| 245 | +
|
| 246 | + Where User is the current instance. |
| 247 | +
|
| 248 | + Returns: |
| 249 | + :class:`telegram.Message`: On success, instance representing the message posted. |
| 250 | +
|
| 251 | + """ |
| 252 | + return self.send_voice(chat_id=self.id, *args, **kwargs) |
0 commit comments