Discord message monitoring without using a self-bot? - discord

Is there a way to monitor messages in Discord without using a self-bot since it's against ToS? I want to monitor certain channels in each of my servers and mirror into my private server to make it easier to read and react to the information coming in that I care the most about instead of scrolling through each server for that specific channel(s).
I thought of using a kind of script for the web app and console to send to a webhook in my server but I'm not sure how to setup a on_message kind of event for console.

This is possible in python by the use of websockets. You can try something like this:
import websocket
import json
url = "wss://gateway.discord.gg/?encoding=json&v=9"
payload = {
"op":2,
"d":{
"token":"your token",
"properties":{
"$os":"",
"$browser":"",
"$device":""}
}
}
ws = websocket.WebSocket()
ws.connect(url)
while True:
print(ws.recv())
You can find a more detailed code here

Related

When using the react-calendly package can I grab the users input data (name and email) for tracking?

I'm trying to implement a calendly widget in my webpage. I'm using the react-calendly NPM package and the implementation is simple but I would like to grab the name and email address that the user puts into the widget for tracking purposes. Is that data available to my application, and if so do you know how I get it? Please don't crucify me, this is my first ever post. :)
import { InlineWidget } from 'react-calendly';
const App = () => {
return <InlineWidget url="yourcalendlyurl"/>
}
export default App
The easiest way to get this information into your application would be to create a webhook subscription with Calendly's v2 api (see here).
When a Calendly event is scheduled a POST request will be sent to your server that includes the invitee's information - https://developer.calendly.com/api-docs/c2NoOjI3ODE4MDgw-webhook-payload

Retrieve data from post webhook using React

So this is a more general question and I did not know who to turn to. I have configured a webhook using from a live streaming third party platform I am using. I did this using Golang and tested my webhook I am getting the POST data how I want. Now the problem is how do you get this data back on the front end. I have looked into setting up websockets and server side events. They both don't make too much sense to me as I see the work on the front end should be pretty straightforward. I don't think I should have to configure another endpoint to get the webhook data and it doesn't listen to the webhook async anyway so I don't think that will work. Any help please...

Not able to create events using Microsoft Graph SDK

I am trying to create an Event using Microsoft Graph SDK, as following the document #
https://learn.microsoft.com/en-us/graph/api/user-post-events?view=graph-rest-beta&tabs=csharp
1.Created "authProvider"
2.Created GraphClient with above AuthProvider
3.Creating Event using
The event is not creating also no exception/error is throwing, Could any one help me here?
This is happening because this call is being made with same transactionId frequently. It avoids unnecessary retries on the server.
It is an optional parameter , just comment out this property and try again. It should work.
Note : This identifier specified by a client app for the server , to avoid redundant POST operations in case of client retries to create the same event and also useful when low network connectivity causes the client to time out before receiving a response from the server for the client's prior create-event request.
More info is required here, as the reply from Allen Wu stated. without any details I would focus my efforts on the authprovider piece and azure app registration piece. as the rest of the example is just sending a post request to graph api.
but what is recommended really depends on what type of application you are trying to build. eg. is it a service daemon, a web app, mobile app, desktop app, single page app, etc.

React, API keys and intermediary services

I am kind of new to React, so this might be just lack of experience, but I don't seem to find any answer to my question:
I have a react app, where I need to subscribe to a push notification channel. Messages are delivered through PubNub, and in order to connect I need to supply a subscribe and a publish key to the message server. Now, I know it is not a good practice to store secrets in a react app, and they should be handled through backend services, but do I really need to create a service just to subscribe to the channel and forward the messages to my frontend app? Is this not an overkill?
The messages I am receiving are just time ticks (I need a trusted source of time), but I still don't want my API keys to leak out...
Is there any reasonably ok way for me to avoid standing up an intermediate service?
It is perfectly normal to have your PubNub publish and subscribe keys in client side code. If it is necessary to restrict who has the power to publish and subscribe (read/write) using those keys, the developer can enable PubNub Access Manager (PAM) in the admin panel. There are PAM guides to get you started on controlling access.
Another point to consider is that your JavaScript PubNub connection can also be used as a trusted source of time. The JS SDK time call will get a 17 place precision unix timestamp from a PubNub node:
const pubnub = new PubNub({
publishKey: 'your_free_pubnub_publish_key',
subscribeKey: 'your_free_pubnub_subscribe_key'
});
let pojoDateObject;
pubnub.time().then((timetokenObject) => {
pojoDateObject = new Date(+String(timetokenObject.timetoken).substring(0,13));
});

App engine channel deploy

I created an application that has ~50 users.
I am trying to use channel API but I've run into a problem while testing with message send.
I am saving the token into the database so i can use the same token if an user opens multiple tabs with the same interface and i have a servlet that resets my token when it expires.
It works fine until I redeploy my application or change the version of my app. I stop receiving messages. If I try to open a channel with the old app version token it doesn't throw an error or anything, it opens it but I still don't receive messages on that channel.
If I reset my token it works OK again.
Does anyone know of a solution to this bug, or has anyone had it before? I deploy often while people are working so I can't ignore it.
My best guess is that ChannelServiceFactory.getChannelService() returns a different instance of ChannelService so when I call channelService.sendMessage("id","message"); it sends it to a different channel.
I can't explain why stored tokens wouldn't work on re-deploying your app (they should), but I can explain why they don't work when you change versions. Briefly, tokens are specific to an app version.
First, the reason for this: we want to ensure that applications that send different data or change message formats or whatever in different versions don't send messages across version boundaries. In the same way that you don't want your javascript bundle from v1 rendering against servlets on v2, you wouldn't want v1 your javascript message handlers receiving messages from v2 servlets (or vice versa).
So, to hopefully make it clear what's going on:
A channel is identified by a combination of your appid, your app version, and the clientid that you provide when you call createChannel or sendMessage. The implementation of the Channel API doesn't store any mapping of appid/clientid -> token. To greatly simplify, you can think of createChannel as doing something like this:
public String createChannel(clientid) {
// obviously we don't really just append strings to each other for actual implementation.
return encryptStringSomehow(clientid + globalAppInfo.version + globalAppInfo.appid);
}
and sendMessage is like this:
public void sendMessage(clientid, message) {
// identify the JID used for this channel.
JID xmppJid = new JID(mutateString(clientid + globalAppInfo.version + globalAppInfo.appid),
CHANNEL_XMPP_DOMAIN); // some domain used for channel messages
// send the <message> stanza to that jid with the application message as the body
xmppService.sendMessage(xmppJid, encodeSomehow(message));
}
and on the client side, the servlet responsible for the channel decrypts the token and binds to the endpoint identified by a JID created by the same method as the sendMessage function.
The upshot is that tokens are only valid for messages sent from the same version of the app that created them.

Resources