Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

How to specify a value for send_dice method?#3635

AnsweredbyBibo-Joshi
matryosha asked this question inQ&A
Discussion options

As I want to specify exact value for a dice how should I do this?

defsend_dice(
self,
chat_id:Union[int,str],
disable_notification:ODVInput[bool]=DEFAULT_NONE,
reply_to_message_id:int=None,
reply_markup:ReplyMarkup=None,
timeout:ODVInput[float]=DEFAULT_NONE,
emoji:str=None,
api_kwargs:JSONDict=None,
allow_sending_without_reply:ODVInput[bool]=DEFAULT_NONE,
protect_content:bool=None,
)->Message:

I also tried telegram.Dice class as it accepts emoji andvalue but using it with send_dice method throws exception that Dice cannot be serialized.

You must be logged in to vote

You can't. The bot API doesn't support that. The closest you can get is forwarding a message that contains a die with the desired value.

Replies: 1 comment 5 replies

Comment options

You can't. The bot API doesn't support that. The closest you can get is forwarding a message that contains a die with the desired value.

You must be logged in to vote
5 replies
@matryosha
Comment options

The bot api definitelysupport it. As for python-telegram-bot I am not sure but if the lib does not support it then docs for send_dice is misleading because it says otherwise:

emoji (:obj:`str`, optional): Emoji on which the dice throw animation is based.
Currently, must be one of “🎲”, “🎯”, “🏀”, “⚽”, "🎳", or “🎰”. Dice can have
values 1-6 for “🎲”, “🎯” and "🎳", values 1-5 for “🏀” and “⚽”, and values 1-64

@matryosha
Comment options

Did I misunderstood the whole thing assuming it can be used for sending values but that's only for receiving a result value after one of the dice sticker has been sent?

@matryosha
Comment options

Did I misunderstood the whole thing assuming it can be used for sending values but that's only for receiving a result value after one of the dice sticker has been sent?

I did. It clearly saysrandom value in the official api and in python-telegram-bot.
Also I found that there was a question in stackoverflow with the same inquire as mine so it would not be a bad idea to add the remark about it in docs.

@treasur08
Comment options

Did I misunderstood the whole thing assuming it can be used for sending values but that's only for receiving a result value after one of the dice sticker has been sent?

I did. It clearly saysrandom value in the official api and in python-telegram-bot. Also I found that there was a question in stackoverflow with the same inquire as mine so it would not be a bad idea to add the remark about it in docs.

did u fix it

@matryosha
Comment options

@treasur08 There wasn't really anything to fix as I misunderstood the method in question.

Answer selected bymatryosha
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Category
Q&A
Labels
None yet
3 participants
@matryosha@Bibo-Joshi@treasur08

[8]ページ先頭

©2009-2025 Movatter.jp