Listen to Discord messages in R
Budget: $30 – $250 USD
I want to develop a simple code in R that listen/waits for new messages from a Discord channel.
Currently, I am running an R code that uses the R function GET to get all the messages in a Discord Channel, then R does an analysis of such messages. This is a time sensitive operation, so I make such a request for new messages every 1 second. As you can image, many of my requests are unnecessary as there may not be new messages.
What I want you to do is a simple code in R that:
1. uses the web-hook from a Discord channel,
2. waits for a new message to arrive and then as they arrive
3. does an operation.
The test of the code should be like this:
1. Send a message to the discord channel with the number 2
2. R should be iddle while no messages are transmitted, but as the message arrives, R take the number 2, adds 2, and then print the results. So the R console should show the number 4.
3. If I send a message to the Discord channel with the number 5 , R should print 7.... you get the idea...basically do a small process for each new message. The process is done as the message arrives and not each set time interval. This code needs to be done in R, and the simpler the better. Each line of the code needs to be commented, so i know what you have done.
This is a pretty basic function in Python from the module Discord.py. And there are several R packages (shiny, webhook, webhooks, websocket) that claim to do this, but I failed to implement them as they all require the URL to be wss:// and not https:// as provided by the discord webhook.
Here is an example of a functional webhook in R, using the wss:// lines.
https://stackoverflow.com/questions/75443379/how-to-make-r-listen-to-messages-from-discord
Currently, I am running an R code that uses the R function GET to get all the messages in a Discord Channel, then R does an analysis of such messages. This is a time sensitive operation, so I make such a request for new messages every 1 second. As you can image, many of my requests are unnecessary as there may not be new messages.
What I want you to do is a simple code in R that:
1. uses the web-hook from a Discord channel,
2. waits for a new message to arrive and then as they arrive
3. does an operation.
The test of the code should be like this:
1. Send a message to the discord channel with the number 2
2. R should be iddle while no messages are transmitted, but as the message arrives, R take the number 2, adds 2, and then print the results. So the R console should show the number 4.
3. If I send a message to the Discord channel with the number 5 , R should print 7.... you get the idea...basically do a small process for each new message. The process is done as the message arrives and not each set time interval. This code needs to be done in R, and the simpler the better. Each line of the code needs to be commented, so i know what you have done.
This is a pretty basic function in Python from the module Discord.py. And there are several R packages (shiny, webhook, webhooks, websocket) that claim to do this, but I failed to implement them as they all require the URL to be wss:// and not https:// as provided by the discord webhook.
Here is an example of a functional webhook in R, using the wss:// lines.
https://stackoverflow.com/questions/75443379/how-to-make-r-listen-to-messages-from-discord