Discord Chat bot keeps hitting 1000 connection limit; - heroku

I have a Discord Bot that was made up so that I could connect the chat channel from a game to my discord server's chat, that way players could talk back and forth without having to necessarily be in-game. However, the Bot keeps connecting to Discord more than 1000 times within a short time period, and as such, Discord automatically resets the Bot's token.
I was wondering if there is a way to avoid this so that the Bot can be constantly running?
This is the code for the Bot: https://github.com/sstuebs/PhilthyPhil
I am also keeping this Bot running 24/7 via Heroku, if that matters.

The Procfile in your project is missing info. Here's a detailed guide

Related

Offline-directline: My webchat app keeps sending GET requests to /directline/conversations/ endpoint. Is this normal?

I had a local bot which I wanted to test in WebChat client instead of Emulator. After researching for a while and failing to connect normally, I stumbled upon a package called offline-directline which helped me connect my local bot successfully. My directline runs on 4000, webchat runs on 3000 and local bot runs on 3979.
I took a peak in the network tab later and I see my client keeps making GET requests to /directline/conversations/ endpoint. At first I thought it happens when I am sending messages in my WebChat client but it keeps sending them repeatedly. Around 50 GET requests in a minute.
I am not sure if this is a normal behavior. Would really appreciate an input. Thank you.

Add skype bot to a group

I have created a Skype bot using the Microsoft Bot Framework and published it with Azure bot channel registration. I can chat with the bot and it works fine.
But I'm not able to add this bot to any group conversation.
I've made sure that Enable adding to a group option is selected for this bot in the Skype channel config section.
EDIT:
A day passed and now I can add bot to groups and see its avatar from Skype PC client. But I have the same issue when working from Mac / iPad client.
Per Skype tech support, the Bots support functionality will be discontinued.
But according to Azure channels documentation:
As of October 31, 2019 the Skype channel no longer accepts new Bot publishing requests. This means that you can continue to develop bots using the Skype channel, but your bot will be limited to 100 users. You will not be able to publish your bot to a larger audience. Current Skype bots will continue to run uninterrupted
I'm ok with my bot being limited to 100 users, I just want it to work and behave correctly on all platforms.
EDIT 2:
Now bot works fine on all the platforms I have. Not sure if this was a caching issue on Skype side or if recent app updates fixed that.
You might be interested in this answer: Add bot to existing Skype group chat
If you use the Add bots button in the group profile you will only be
able to look up published bots:
However, if you use the Add to Group button in the upper right corner
(not available in the mobile client), you can find your bots that are
still in preview:
As you can see, this currently only works in the desktop client. If you are getting undesired behavior in other clients, the only thing anyone can do on Stack Overflow is recommend workarounds or tell you to report the bug. Since Skype bots are mostly deprecated, I do not expect this bug to be fixed but you can try to report it anyway. My recommended workaround is to stop using deprecated channels if you would like a better experience. Microsoft Teams is great for corporate communications. If you want personal communication then you may have to use a third-party channel like Slack or Telegram.

Registration of new bots for skype

I need to create a Skype bot, but registration of new bots was terminated.
In this regard, I have several questions:
Will an alternative technology for automatically sending messages to classic skype (No skype for business) be provided?
will registration of new bots be renewed, if so how soon?
is it possible to register a bot as an exception? Since it is extremely important for the further development of our software product.
As per the documentation
As of October 31, 2019 the Skype channel no longer accepts new Bot publishing requests. This means that you can continue to develop bots using the Skype channel, but your bot will be limited to 100 users. You will not be able to publish your bot to a larger audience. Current Skype bots will continue to run uninterrupted. Learn more
You are still able to develop Skype bot but they will be limited to 100 users.
I think they are more focusing on Microsoft Teams instead.

Interact with slack bot without a public accessible server

For some security reasons that I can't have a public accessible server to receive data from slack.
So, this is what I'm planning to do:
Inbound message from slack: using RTM API
Outbound message to slack: using RTM API or Web API
Questions:
Any better alternatives?
Any restrictions? (AFAIK, buttons and drop downs can't work)
If Web API reach rate limit, can I use incoming webhook as a backup plan?
RTM only approach
Yes, that would work. With only the RTM API you are limited to:
receiving and responding to messages
Other RTM events.
You can't use any interactive functionality like:
Interactive components (buttons, menus, datepickers)
Dialogs
Rate limit on message posting
Using the webhook as "backup" to circumvent the rate limit is not an option, since the rate limit of posting max 1 message per second applies to all form of message posting.
From the documentation:
In general, apps may post no more than one message per second per
channel, whether a message is posted via chat.postMessage, an incoming
webhook, or one of the many other ways to send messages in to Slack.
Alternatives
You did not give any details about the reasons why your app can't expose an endpoint to the public Internet. But you might want to consider using a VPN tunnel like ngrok.
Yes! Socket Mode
There is a new alternative from slack, Socket Mode, which doesn't require a publicly accessible server.
Note: this is only for private apps.
With Socket Mode you have an API token and your server uses it to communicate with Slack's servers and create a two way socket connection. This means your Slack Bot's code can run on a machine behind a firewall and not require any inbound ports to be opened.
Slack message delivery requires an acknowledgement once you get the message, or else they may retry to deliver it.
Limitations
Socket Mode has two main limitations:
Apps using Socket Mode are not currently allowed in the public Slack App Directory.
Socket Mode is only available for apps using new, granular permissions. If you created your app on or after December of 2019, good news: your app already uses the new permissions. Otherwise, you may have to migrate your classic Slack app to use granular permissions before turning on Socket Mode.

Keeping the bot alive

We are building a bot using the MS Bot Framework. Sometimes when the bot is not used, it takes too much time to respond and we get a [500] Internal Server Error. We see this issue when we try to access the bot on our app (we are using Direct Line to interact with the bot).
I've read other answers about making sure the Microsoft Azure setting for application activity is set to "Always On", and we have done this. But as Always on is pinging the root of our bot web app, I think it may not be enough to keep the bot / directline alive...
And I don't have any rewrite rules from http to https preventing the ping request to be successful..
Anybody had this issue?
UPDATE to ask a specific question : How can we make sure that our bot is ALWAYS alive if all the settings explained above do not work ? Should we ping our bot thru the directline framework ?
One way to do it would be to send a ping every 15 minutes. The default code even gives you a place to handle the ping in the message controller
else if (message.Type == ActivityTypes.Ping)
{
}
please also take a look at this post as it may work for you and is a very simple solution with no code.
I had to create an azure function that pings my service, as I was having this same problem. I have Always On for all my services, and still find the bot going to sleep. With the ping service, it establishes a new conversation, sends the utterance, and then closes after receiving the response. This has seemed to work, but is only a week into practice. Note, I am pinging every five minutes.

Resources