Slack Bot: invite a non-bot user when # mentioning them - python

I'm working on a Slack bot that #-mentions non-bot users into a particular channel. Is it possible to also invite these users to the channel when they are mentioned? (Like when a non-bot user mentions another non-bot user)
I'm using the Python slack client for this, but I suspect what I want to do is at the API level. Any ideas would be appreciated!

The python library don't have the api call wrapped (you could open an issue for that) but the API itself have a way to invite users to a channel, you just need to make a request to channels.invite

Related

How to forward/read messages from another channel with telebot?

I have a bot that's supposed to forward news from other news channels. How do I make the bot join these channels so it could access all the messages that are being posted? I'm using pyTelegramBotApi. How should I go about doing this? Any help would be appreciated.
Only a channel admin can subscribe a bot to the channel.
A way that doesn't require admin rights in a source channel is to use the MTProto API (a telegram client library, e.g. Telethon library) instead of the Bot API.

Telegram Bot - Persist Pickle Context across all Users in a Group Chat

I set out to create a Telegram bot that tracks 'upvote' like functionality in a Group Chat. To try to do this, I adapted the persistentconversationbot.py code from the python-telegram-bot package. I got the bot running and managed to deploy it on to Heroku.
Once I invited the bot into a private group chat, I noticed that this approach is only remembering conversations with specific users. I'd like to have the bot remember conversations it has had with all users in a group chat. Would any of you happen to know how I can do this?
Thank you!
Please see this explanation on the per_* parameters of ConversationHandler. Note that this is independent of whether your bot uses persistence or not.

Is it possible to get all channels a slack bot is allowed to write?

I am trying to build a slack bot based on heroku and python which writes messages every 10 minutes to all channels the bot is allowed to write messages. It would be perfect if I could just read from the slack api to which channelId's the bot is connected and let the bot post the message to all channels at the same time.
Till now I couldnt find such function in the slack api. On the other hand I have to addmit that I am pretty new to slack. Is there a similiar function out there or can you think of a work around? If possible I would like to avoid storing data additionally somewhere.
Yes there is. Call users.conversations with your bot token to get the list of channels it is a member of.
From the documentation:
This method helps answer questions like:
Which conversations am I a member of?
Which public channels is my bot user in?
Do I have any direct messages open with my friend Suzy?
Is my bot a member of any private channels?

How to login as user rather bot in discord server and run commands?

Slack API provides you two options: use app as a bot and as a logged in user itself. I want to create App that will be working as a user and run channel commands. How can I do with discord.py?
Discord.py is no longer maintained to work on user accounts, so given the recent updates in the user api, it is no longer the ideal framework which selfbots should be written in.
There are a number of selfbot api libs out there, but the best one that's written in python is this: https://github.com/Merubokkusu/Discord-S.C.U.M
P.S. selfbotting against tos - so be careful (respect rate limits and don't act like a bot)
As Wright has commented, this is against discord's ToS. If you get caught using a selfbot, your account will be banned. However, if you still REALLY want to do this, what you need to do is add/replace bot.run('email', 'password') to the bottom of your bot, or client.run('email', 'password') to the bottom depending on how your bot is programmed.

How to join my Telegram Bot to PUBLIC channel

My question is:
how to join my telegram bot to a telegram public channel that I am not an administrator of it, and without asking the channel's admin to add my bot to the channel?
Maybe, the chatId of channel or thru link of channel?
I have heard that some people claim to do this join their bot to channels, and scrape data.
So if Telegram does not allow it, how can they do it? can you think of any work around?
Thank you in advance :)
Answer to your edited question.
It was possible to add a bot to a group/channel with just an invite link. This was achieved by allowing a bot to access the mtproto methods like messages.importChatInvite for private links and channels.joinChannel. However telegram patched this. However, you can still do this with normal user accounts! Since you are using python you can give this a shot. I can confirm the methods still work on Madeline Proto.
Till today, only the Channel Creator can add a bot (as Administrator or Member) to the Channel, whether public or private. Even the other Channel Administrators cannot add a normal member leave alone adding a bot, rather they can only post into the channel.
As far as joining the bot via the invite link, there is yet no such method in Bot API to do so. All such claims of adding the bot to a channel by non Creator are false.
Another way of "scraping the data" from several channels would be to listen to these channels with a Junction Bot aka Channels, Multi Feed Edge Bot, or alike. You just need to go to the channel info and share the link of the desired channel with the Junction Bot to automate the process of receiving new messages from the(se) channel(s). There are also other quite advanced ways described in their FAQ.
Multi Feed Edge Bot also seems to work O'kay, however, you need to follow these steps to add the redirection:
/add #TelespaceNews https://t.me/joinchat/AAAAAFIaTHjZp8ltykgwEQ
You can only add bots to channels you are an admin in them and bots can only be added as admins. for this go to Manager Channel, click on Administrators / Add Administrator then search for the bot you want to add to your channel.

Categories

Resources