久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

Discord bot 編輯消息太慢

Discord bot editing messages too slow(Discord bot 編輯消息太慢)
本文介紹了Discord bot 編輯消息太慢的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

問題描述

我希望我的 discordbot 發送帶有附件和文本的發送消息.然后機器人必須編輯此文本幾次,但問題是當機器人編輯消息 5 次時,它會等待一段時間,然后再次編輯 5 次等等.我怎樣才能讓它不停地編輯消息?

I want my discordbot to send send a message with an attached file in it and a text. Then the bot has to edit this text a couple of times but the problem is that when bot eddits message 5 times then it waits some time and then edits again 5 times etc etc. How can i make it edit messages without stopping?

if(msg.content.includes("letter")){                                       


msg.channel.send("alphabet", { files: ["/Users/48602/Videos/discordbot/aaa.png"]})}
      if(msg.content === 'alphabet'){


        msg.edit("**a**")
        msg.edit("**b**")
        msg.edit("**c**")
        msg.edit("**d**") // Here bot stop for a 2 seconds and i dont know why
        msg.edit("**e**")
        msg.edit("**f**")
        msg.edit("**g**")
        msg.edit("**h**")
        msg.edit("**i**")
        msg.edit("**j**")// Here bot stop for a 2 seconds and i dont know why
        msg.edit("**k**")
        msg.edit("**l**")
        msg.edit("**m**")
        msg.edit("**n**")
        msg.edit("**o**") // Here bot stop for a 2 seconds and i dont know why

      msg.delete()
      }

推薦答案

Discord 有一個 每個請求的速率限制為 5.試圖繞過這一點將被視為 API 濫用(后面的解決方案不是 API 濫用).

Discord has a rate limit of 5 in each request. Trying to bypass this would be considered API abuse (the solutions later is not API abuse).

超過此限制將暫停其他請求,直到經過一定秒數.隨著我的研究,我發現了這個簡單解釋:每臺服務器每 5 秒 5 次(如果你不明白我上面所說的).

Exceeding this limit will pause other requests until a certain number of seconds has passed. Along with my research, I came across this simple explanation: 5 anything per 5 seconds per server (if you did not understand what I said above).

在 Discord 的速率限制開發者指南上,它告訴您:

上述規則[速率限制]目前有一個例外,即不同的 HTTP 方法共享相同的速率限制,即刪除消息.刪除消息屬于單獨的更高速率限制,以便機器人能夠更快地從頻道中刪除內容(這對于審核機器人很有用).

There is currently a single exception to the above rule [rate limits] regarding different HTTP methods sharing the same rate limit, and that is for the deletion of messages. Deleting messages falls under a separate, higher rate limit so that bots are able to more quickly delete content from channels (which is useful for moderation bots).

在不濫用 API 的情況下,一種解決方法是發送消息,然后刪除以前的消息,因為刪除消息的限制更高.

One workaround, without API abusing, would be to send messages, and delete the previous messages since there is a higher limit for deleting messages.

另一種解決方法是為您的動畫添加中間超時.一個簡單的方法如:

Another workaround would be to add intermediate timeouts to your animation. A simple method such as:

function async wait = { require("util").promisify(setTimeout); };
//syntax: await wait(1000); to "pause" for 1 second

您需要調整時間,使其符合您預期的動畫速度,并且不會因速率限制而暫停.

You will need to play around with the timings so it fits your intended animation speed, and without pausing due to the rate limit.

這篇關于Discord bot 編輯消息太慢的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

相關文檔推薦

Using discord.js to detect image and respond(使用 discord.js 檢測圖像并響應)
Check if user ID exists in Discord server(檢查 Discord 服務器中是否存在用戶 ID)
Guild Member Add does not work (discordjs)(公會成員添加不起作用(discordjs))
Creating my first bot using REPLIT but always error Discord.JS(使用 REPLIT 創建我的第一個機器人,但總是錯誤 Discord.JS)
How do I code event/command handlers for my Discord.js bot?(如何為我的 Discord.js 機器人編寫事件/命令處理程序?)
How to find a User ID from a Username in Discord.js?(如何從 Discord.js 中的用戶名中查找用戶 ID?)
主站蜘蛛池模板: 羞羞的视频免费看 | 91av大全| 亚洲美女视频 | 亚洲综合在线视频 | 碰碰视频| 欧美网站一区 | 精品国产乱码久久久久久久久 | 2020国产在线| 女人一区| 亚洲一区二区视频在线播放 | 中文字幕一区在线观看视频 | 中文字幕成人 | 国产精品久久久久久吹潮 | 亚洲免费一 | 国产精品久久久久久久久久 | 中国一级毛片免费 | 91电影 | 国产成人精品免费视频大全最热 | 久久久免费在线观看 | h在线观看 | 久久精品成人热国产成 | 精品久久99 | 亚洲一区二区精品视频 | 一区二区三区四区在线 | 国产精品免费高清 | 中文字幕综合 | 91精品国产综合久久久久久丝袜 | 日韩和的一区二在线 | 99热在线播放 | 亚洲国产精品第一区二区 | 97国产精品 | 免费观看一级毛片视频 | 91精品久久久久久久久中文字幕 | 国产亚洲精品精品国产亚洲综合 | 精品在线观看一区二区 | 男人的天堂久久 | 自拍中文字幕 | 亚洲精品久 | 亚洲精品久久区二区三区蜜桃臀 | 亚洲精品久久久一区二区三区 | 欧美精品一区二区三区在线 |