簡體   English   中英

Telegram Bot API無法在24小時內限制用戶

[英]Telegram bot api not able to restrict user for 24 hours

尋找一種使用restrictChatMember()限制聊天成員的解決方案,但不幸的是,它仍然永遠限制用戶24小時。

const { date:joinDate } = ctx.message;

const releaseDate = moment.unix(joinDate).add(1, 'day');
ctx.telegram.restrictChatMember(
  ctx.chat.id,
  memberID,
  releaseDate,
  false,
  false,
  false,
  false
);

參考: https : //core.telegram.org/bots/api#restrictchatmember

您是將moment對象傳遞回函數,而不是像您引用的文檔所說的那樣是UNIX時間戳:

until_date :可選整數
取消限制日期的日期,Unix時間。 如果從當前時間起限制用戶使用超過366天或少於30秒,則將其視為永遠受限制。

嘗試

ctx.telegram.restrictChatMember(
  ctx.chat.id,
  memberID,
  releaseDate.unix(),
  ...

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM