Flutter await channel.watch({presence: true}) - getstream-io

I can not add the presence property to the channel in order to watch for users going online or offline. Is there any way around this ? do I have to use something like queryUsers each time I want to listen for their online presence ?
I tried searching the docs, every youtube tutorial, documentation but I have not found anything useful on the matter.

User's online status change can be handled via event delegation by subscribing to the user.presence.changed event the same you do for any other event.
client.on('user.presence.changed')
More info:
https://getstream.io/chat/docs/flutter-dart/presence_format/?language=dart#listening-to-presence-changes

Related

Getting number of active voice connections

I usually work with discord.js but now I'm contributing to a package that supports discord.io too (it's dbots.js btw).
I need to post bot stats to discordbotlist's API and they support the number of active voice connections too: how can I get it in discord.io?
I've tried searching for properties and method in the docs but I can't find anything like discord.js' Client.voiceConnections.
Does anybody know how to find it?
The guy the owns the package figured it out:
Object.keys(client._vChannels).length

Spotify API - Can I find the Completion % of a song?

I am working with some clients who want to be able to see the average completion percentage their tracks are listened to on Spotify (e.g. 50% is half the song).
The API documentation doesnt show how this can be done, but i have seen some label platforms offering this data (AWAL etc)
Am I missing anything obvious?
API Document Link: https://developer.spotify.com/documentation/
Thanks in advance!
I've looked through the documentation and no obvious field for completion time
As for many APIs there seems to be a separate one for Analytics https://analytics.spotify.com/faq/api#api
It also looks like you need to be a label/author registered with Spotify https://analytics.spotify.com/c/api/

Telegram Bot Event When Users Join To Channel

After create telegram bot, access and admin this bot to channel. how to get channel members list or event when users join to this channel?
Pretty disappointed with the current answers, so I'll leave an updated (as of February 2018) answer that explains how to do this with the Telegram API itself, as well as with the framework I am using, Telegraf for Node.
The Telegram API is both very powerful, and pretty simple as far as API's go. If you are using the polling method of getting updates, and not websockets which are a whole other issue, checking if someone new has been added to a group or channel is very easy.
The API method getUpdates returns an array of Update objects, which contain all of the possible information you could want including any messages sent, inline queries, and new chat members. To get any new chat members you simply need to access update.message.new_chat_members which will contain an array of new users. For reference you can look in the API documentation here.
To fetch the update objects in browser, or with curl, all you have to do is send a GET or POST request to https://api.telegram.org/botYOUR-BOT-TOKEN/getUpdates. Then just look for messages->new_chat_members.
If you are using the Telegraf bot framework with NodeJs you can use the bot.on method with the event new_chat_members.
Example:
bot.on('new_chat_members', (ctx) => console.log(ctx.message.new_chat_members))
I know this was asked a while ago, but I hope this helps other people searching.
From docs:
new_chat_members New members that were added to the group or supergroup and information about them (the bot itself may be one of these members)
So i think you can't.
To get updates on users join group or channel you must correctly setup webhook for your bot. This update type is disabled by default. See https://core.telegram.org/bots/api#setwebhook
allowed_updates
A JSON-serialized list of the update types you want your bot to
receive. For example, specify [“message”, “edited_channel_post”,
“callback_query”] to only receive updates of these types. See Update
for a complete list of available update types. Specify an empty list
to receive all update types except chat_member (default). If not
specified, the previous setting will be used.
Please note that this parameter doesn't affect updates created before the call to the getUpdates, so unwanted updates may be received
for a short period of time.
So, the request should look like this:
https://api.telegram.org/<BOT_TOKEN>/setWebhook?url=<WEBHOOK_URL>&allowed_updates=["chat_member"]
Yes! You can use this:
https://api.telegram.org/bot[TOKEN]/promoteChatMember?chat_id=#[channelname]&user_id=[user_id]
if user is joined response is ok, else response is not ok.

How To Send Notifications To A Specific User Group / Role Only using Socket.io?

I am working on a project which I want to implement a feature where after an action happens, I want to notify all online administrators on the web app and show them a message that an action happened.
I have a few questions:
How can I identify which user is online and has an admin role? I am looking for some ideas around "show all online users" list
Should I put these admins into a room where I can broadcast the notification only to that room?
How can I get all users who are online and associate their socket ID with the ID / Username in the database?
I will also need the online status to be shown in a table so I can know if UserOne and John are online at the moment.
How can I keep the online / offline status? Do I have to keep the status somewhere outside of the database?
I am using Laravel v5.1, NodeJS v5.0, Socket.io v1.3 and Redis to play around with the notifications.
Does anyone have any idea how can I deal with this problem? I am not really looking for any code specific stuff, I am just curious about the theory behind the idea and how it will work.
Thanks!

how subscribing to instagram realtime api helps me to get user/media details

I have subscribed to instagram realtime api to receive POST updates for hashtag #sudhir
I am able to get updates to my server this way :
{"changed_aspect":"media", "subscription_id":2935881, "object":"tag", "object_id":"sudhir", "time":1362748903}
I don't find any user related or media related info in these updates. I found in SO that we have to hit their (instagram) endpoints explicitly to get photos/user info, inspite of subscribing to endpoints.
If we have to make request explicitly, then what is the use of subscribing to particular endpoint.?
What is the use of this json data ({"changed_aspect":"media","subscription_id":2935881,"object":"tag","object_id":"nofilter","time":1362748903}) we get in request body of our servlet. ?
Can we use this data in any way to get actual data of user/media ?
Any help or suggestions would be appreciated :)
Nothing useful I'm afraid. Once you have that information you know that something has changed on Instagram's end. You are then supposed to fire off the corresponding request. From your example it looks like you want to then do a tag/recent/ request and filter out anything earlier than the "time" variable.
Not the easiest way to do things unfortunately but they seem to have decided that the hard way of doing things is the way to go.

Resources