Finding a Discord server ID with just a member ID connected to a voice channel - node.js

So the discord bot (Discord v12) I'm designing in nodejs has a command that must go through a DM (it's a silent auction bot so the bid messages being sent as bids can't be seen). Since I'm designing the bot to be able to be used on multiple servers I need a way to assign the server ID from the DM message so the bot knows the bid is for that particular server's auction. Since it's a DM I can't pull the server ID from the message itself.
The only way I've thought to accomplish this is by having the members logged into a voice channel of the server, but I can't figure out a way to pull the server ID from the voice channel itself. Is there a way to pull the voice channel ID a member ID is currently logged into and pull the server ID from that?

You can get information regarding a voice channel where the user is logged with the VoiceState object.
You can get it from a member's .voice attribute.

Related

Invalid user identity in provided tenant implementing bot proactive message

I have a bot application developed in java sdk. To integrate with MS Teams, I have a connector has been created using Bot Framework and Spring Boot and a Bot Channels Registration on the Azure portal. Everything working properly. Now I'm trying to implement proactive messages by following this tutorial: https://www.vrdmn.com/2020/02/microsoft-bot-framework-v4-send.html
I can already make the bot send proactive messages on channels, but now I need to implement the post a proactive personal message to a user.
I can get data from a user:
var user = await ((Conversations)connectorClient.Conversations).GetConversationMemberAsync(mentionUserPrincipalName, teamInternalId, default);
But when running the line...
var response = await connectorClient.Conversations.CreateConversationAsync(conversationParameters);
...a bad request result is returned with the message "Invalid user identity in provided tenant":
You can get the user details using teams roster. To create a new conversation or conversation thread in a channel, you must have the correct ID. You can receive or retrieve this ID. Please check Get the user ID, team ID or channel ID. You can also fetch the list the members of a team using teams roaster. Please check Fetch the roster or user profile.

Telegram: Can a bot write a message to a specific user in a group?

I have a telegram group with several human members and a bot. This bot sends regular status updates to the group. I do this with a simple curl command.
https://api.telegram.org/bot<MYBOT-ID>/sendMessage?chat_id=<MYCHAT-ID>=&text=hello%20world
Is there a possibility that the bot sends a message to a specific user in the group, e.g. to inform about a failure. The other members of the group should of course not see or hear this.
You can use "user_id" instead of "chat_id" to send the message to the PV of users instead of sending message in the group
https://api.telegram.org/bot<MYBOT-ID>/sendMessage?chat_id=<USER-ID>=&text=hello%20world

How do I know Slack bot's user_id?

I'm making a slack bot (A) that responses to a message from another slack bot (incoming-webhook) (B).
I'd like to know the user_id of B so that its message will be a trigger for A, where I have some problem getting it.
I tried users.list method (https://slack.com/api/users.list?token=blabla) but the B didn't appear in a result.
Do you have an idea about what method to take to know the user_id of B?
Incoming webhooks appear as apps, not as bot users on Slack. So you won't find a bot user ID in the user list as you would for normal bot users.
Apps have a bot ID, but unfortunately there is no official API method to get the list of bots / apps in a workspace. But if you have control over a workspace and can generate a legacy token you can use the unofficial API method bots.list.
There also is the official bots.info method, if you already have the bot ID and just want to know which app it belongs to.
To create a legacy token for your workspace make sure you are logged in and then go to this page.

Retrieve invited users with Telegram Bot API

I have a Telegram channel and a Telegram bot using Node.js and PSQL. With a command (for example /how), I need to return to the user the number of user which has been invited to the channel by this user (and has joined).
How can I retrieve this list of users ?
If by "invited" you mean users who sent others a link to the channel then Telegram API does not provide such functionality.
However, channel administrators can add users to the channel and those should be sent as regular Message updates with new_chat_members field set, all you have to do is log those updates to the database and then fetch it with your command.

Can I start the conversation with messenger bot?

My bot is running in perfect conditions when I use it trought funpage.
But what I want to know is if we can start the conversation with the user instead user with it.
For example: The user is on a page that his next interation is talk with my BOT. But i donĀ“t want my clients start I want my bot starts.
At this case we can consider that user already authorized my app.
Not if this is their first messenger interaction with you.
When you message a user, you're sending a message to a user id that is page scoped.
So unless they've previously messaged your page, there's no way for you to get their id
The id must be an ID that was retrieved through the Messenger entry points or through the Messenger webhooks (e.g., a person may discover your business in Messenger and start a conversation from there.
These IDs are page-scoped IDs (PSID). This means that the IDs are unique for a given page.
If you have an existing Facebook Login integration, user IDs are app-scoped and will not work with the Messenger platform.
(see https://developers.facebook.com/docs/messenger-platform/send-api-reference)

Resources