Skip to content

Currently Supported Methods

Sauraj edited this page Oct 3, 2022 · 7 revisions

Available Telegram Methods

All these methods are defined in util.sh. If you think some methods are missing and you can add them, please go ahead and don't forget to open a pull request with the changes you made.

Commands listed below will only work when you have your Bot token stored in .token file of current directory.

--sendmsg

  • Use this method to send text messages. On success, the sent Message is returned.

Example :

tg --sendmsg "<CHAT ID>" "<Text to Send>"

--sendmarkdownv2msg

Example :

tg --sendmarkdownv2msg "<CHAT ID>" "<Text to Send with markdown>"

--editmsg

  • Use this method to edit a existing message sent by the bot.

Example :

tg --editmsg "<CHAT ID>" "<MESSAGE ID>" "<Text to edit current message>"

--editmarkdownv2msg

Example :

tg --editmarkdownv2msg "<CHAT ID>" "<MESSAGE ID OF MESSAGE>" "<Text with markdown to edit current message>"

--replymsg

  • Use this method to reply a message.

Example :

tg --replymsg "<CHAT ID>" "<MESSAGE ID OF MESSAGE TO REPLY>" "<Text to Reply>"

--replyfile

  • Use this method to reply a message with file.

Example :

tg --replyfile "<CHAT ID>" "<MESSAGE ID OF MESSAGE TO REPLY>" "<Path of file to Reply>"

--replymsghtml

  • Use this method to reply a message but with html formatting.

Example :

tg --replymsghtml "<CHAT ID>" "<MESSAGE ID OF MESSAGE TO REPLY>" "<Text to Reply with HTML Formatting>"

--replymsgmarkdown

Example :

tg --replymsgmarkdown "<CHAT ID>" "<MESSAGE ID OF MESSAGE TO REPLY>" "<Text to Reply with markdown Formatting>" 

--delmsg

  • Use this method to delete telegram message.

Example :

tg --delmsg "<CHAT ID>" "<MESSAGE ID OF MESSAGE TO DELETE>"

--sendsticker

  • Use this method to send sticker.

Example :

tg --sendsticker "<CHAT_ID>" "<FILE ID OF STICKER TO SEND"

--replysticker

  • Use thid method to reply a message with sticker.

Example :

tg --replysticker "<CHAT ID>" "<MESSAGE ID OF MESSAGE TO REPLY>" "<FILE ID OF STICKER TO REPLY"

--fwdmsg

  • Use this method to forward messages of any kind. Service messages can't be forwarded. On success, the sent Message is returned.

Example :

tg --fwdmsg "<CHAT ID TO FORWARD FROM>" "<CHAT ID TO FORWARD FROM>" "MESSAGE OF MESSAGE TO FORWARD"

--cpmsg

  • Use this method to copy messages of any kind. Service messages and invoice messages can't be copied. A quiz poll can be copied only if the value of the field correct_option_id is known to the bot. The method is analogous to the method forwardMessage, but the copied message doesn't have a link to the original message. Returns the MessageId of the sent message on success.

Example :

tg --cpmsg "<CHAT ID TO FORWARD FROM>" "<CHAT ID TO FORWARD FROM>" "MESSAGE ID OF MESSAGE TO FORWARD"

--pinmsg

  • Use this method to add a message to the list of pinned messages in a chat. If the chat is not a private chat, the bot must be an administrator in the chat for this to work and must have the 'can_pin_messages' administrator right in a supergroup or 'can_edit_messages' administrator right in a channel. Returns True on success.

Example :

tg --pinmsg "<CHAT ID>" "MESSAGE ID OF MESSAGE TO PIN"

--unpinmsg

  • Use this method to remove a message from the list of pinned messages in a chat.

Example :

tg --unpinmsg "<CHAT_ID>" "MESSAGE ID OF MESSAGE TO UNPIN"

--getuserpfp

  • Use this method to get a list of profile pictures for a user.

Example :

tg --getuserpfp "<CHAT ID>" "<USER ID OF USER>"

--downloadfile

  • Use this method to download a file.

Example :

tg --downloadfile "<FILE ID>" "<OUTPUT FILE PATH WITH NAME AND EXTENSION>"

--ban

  • Use this method to ban a user.

Example :

tg --ban "<CHAT ID>" "<USER ID OF USER TO BAN>"

--unban

  • Use this method to unban a user.

Example :

tg --unban "<CHAT ID>" "<USER ID OF USER TO UNBAN>"

--sendaudiofile

  • Use this method to send audio files, if you want Telegram clients to display them in the music player. Your audio must be in the .MP3 or .M4A format.

Example :

tg --sendaudiofile "<CHAT ID>" "<PATH OF AUDIO FILE>" "<CAPTION (Optional)"

--sendvoicefile

  • Use this method to send audio files, if you want Telegram clients to display the file as a playable voice message. For this to work, your audio must be in an .OGG file encoded with OPUS (other formats may be sent as Audio or Document).

Example :

tg --sendvoicefile "<CHAT ID>" "<PATH OF AUDIO FILE>" "<CAPTION (Optional)"