Lately, I've worked on a chat bot of my own for twitch.tv, connecting using the IRC channel and using a python script as well as logs from HexChat, my IRC client, to build my bot, which currently can give(upon query) the uptime of the channel, and statistics on emotes in the channel.
However, I have seen Moobot and Nightbot, 2 of the most popular chat bots on twitch, and was wondering how I could:
1) Turn this python script into something a streamer can authorize to be on their channel,
2) Hook up a GUI to this, or a series of text fields for the user to input their settings for the bot while it runs on their channel.
I have looked at previous questions on StackOverflow, looked on Google, and asked in the #twitch-api IRC channel on freenode, however none of these provided the answer, and the only bots I have seen that have this channel-bot integration and authorization are Moobot and Nightbot. Upon clicking "connect to twitch" on moobot's homepage, I can authorize it to use my account much like an oauth request, however I do not know how to set this up. I hope this will help others like me wanting to add some extra usability to their WIP Twitch Chat bot. Thanks!
Moobot: http://twitch.moobot.tv/
Nightbot: https://www.nightbot.tv/
Most of the "big" server-hosted bots consist of 4 major parts:
A database (SQL or NoSQL) holding all the settings etc.
A REST (or similar) API that is used to communicate between the individual parts
A web application for the frontend
A standalone bot for the backend
Keep in mind that this is alot of work to set up. I am currently working on a full rewrite of my bot, which I would share if it wasnt in a pre-alpha state.
Keep in mind that setting up these individual parts might require an experienced web developer. Here is some tips however:
Using python, Django is a great decision for a web application + API backend
As far as I know, there is no decent IRC library for python supporting IRC v3 so you might have to implement your own. Sample implementation of the message parser
Apart from that, see the Twitch.tv API documentation - this includes the Authentification workflow.
If you are looking for a locally-hosted bot, that's a completely different thing to deal with. There is a fair amount of those, some of which are open source too. I dont know any low-level ones, but maybe looking at Botnak, made by a friend of mine, answers some questions.
Related
I have many features that can be customized within the bot and using the commands itself, but this can get confusing and may be bugged at times.
Would there be a way to allow users log into the website using Discord's API and to customize the bot from there?
It's similar to how MEE6 or carl and these bots allow users to customize or
buy a premium version, but just can't seem to find how I can do this myself.
An example is, a user can head onto the website and can turn on the moderation module through their account they have signed in with. This would then connect with the bot in my python file, or change the config json file with the user id, setting moderation = "True".
First of all, to "log in with discord" on your site you'll need to use discord's OAuth2. If you're storing your data in a json file (which I wouldn't recommend for scalability anyway), then you'll have to run you site from the same server as your bot and edit it there. However, you'd be better of in both ways using a cloud-hosted database such as PostgreSQL (SQL) or MongoDB (noSQL). Both of those can either be hosted locally on your machine, or by them in the cloud for free. Personally, I prefer MongoDB. That way you can run your site from wherever and update your database.
I am trying to make a WhatsApp bot inspired by the functioning of Discord bots, the bot will work in WhatsApp groups.
I have looked up the official WhatsApp Business API but I am not sure that they will not approve my number as it is just a hobby project and not a proper "business".
There is an alternative though and that is the Twilio WhatsApp API. However, they provide you with a sandbox. I can interact with it in DMs but as the sandbox number is a business account, I cannot add it to a group like discord.
I intend to write a server in python or node.
Can anyone share a solution or workaround? Only if I could add the Twilio number to a group my problem will be solved. Though I am ready to use any other API/Solutions for this.
There is actually a Python solution for this. It is a pain to set it up, but it still works. Check it out:
https://github.com/mukulhase/WebWhatsapp-Wrapper
It uses the webdriver Selenium to send/retrieve messages through Web-WhatsApp.
Be aware that it is against their rules, so your phone number might get banned!
Like we have slash commands in slack, which helps us to perform get or post
similar to do that do we have anything in Microsoft team and if yes are there any documentations.
I have built some slash commands using pythong in slack but i am not finding anything for teams.
In essence, Teams doesn't provide a 100% direct match to "/slash" commands, but there are equivalents, and they pretty much all involve the use of a Bot. In practice, it really just means going from "/" to "#", as you #mention the bot to invoke it, and it can proceed as needed from there.
That said, there are a few places where you might want to surface this. For instance, the "normal" place is in a chat inside a channel. To make this work, you -can- get away without a Bot, but a Bot is the easiest. If you want to do something outside a channel, like just invoking the bot directly, there are two options - interact with the bot in a 1-1 style (in which case the bot appears in the "chat" left menu, as if it were another user). In this case, incidentally, you don't "#mention" the bot because it's the only other person in the chat. The other option is the command text block right at the top of the screen in Teams. In this case, you can have the bot open UI to send it parameters in a guided form, even.
So, in short, there are similar options to "slash" commands in Teams, but for the most part they involve Bots, so you should look into that more. In particular, look at the Teams development docs for Bots, Message Extensions, and Task Modules.
I suggest you also have a look at Create a bot with the Bot Framework SDK for Python.
You could Add custom bots to Microsoft Teams with outgoing webhooks. A webhook is essentially a POST request sent to a callback URL.
Hi everyone so I’m new to developing bots for Telegram with Python and I need help being able to generate the basic get updates information. I usually can when I use the web browser, you know when you drop the telegram link with the bot token key and finish it up with the GetUpdate function in the address bar then the browser just generates a page with all the info such as chat_id, user_id, firstname,last name, etc. Yeah I want to know how to do that with Python so I can achieve the same results in the python terminal. I’m working with the telegram bot for python package so I think it’s called telegram.ext. I’m using the basic guide which involves me using the Dispatcher and Updater, I’m still learning from the guide but for now I need to know how to get that system/session info using my bot in the python terminal. Feel free to ask any questions to clarify this question, thanks.
So far I the most I can do is print out messages I’ve sent to the bot but that’s about it, it’s pretty much filtered and I don’t want that I want the raw and unorganized information like browser usually provides.
The easiest way is to use requests library:
import requests
r = requests.get('https://api.telegram.org/bot<BOT_TOKEN>/getupdates')
print(r.json())
I'm learning Python and would like to start a small project. It seems that making IRC bots is a popular project amongst beginners so I thought I would implement one. Obviously, there are core functionalities like being able to connect to a server and join a channel but what are some good functionalities that are usually included in the bots? Thanks for your ideas.
Unless it's solely for the educational experience, you should really just use a framework for the core functionality.
That said, here's some of the things the bot in my home IRC channel does:
Choose one item from a list of options
Display a random entry from the Linux fortunes file
Display a random set of words from the Emacs spook file
Check every line from a user and display a quote from The Big Lebowski if it's sufficiently similar (this is probably a bit my-channel specific :) )
Check if a link has been mentioned before and say who/when (we all read the same RSS feeds and tend to duplicate links a lot)
Conduct a poll
Pull a given quote from our internal QDB
Check if a given link has been posted to Reddit, and give the corresponding Reddit thread link if so. If a Reddit link is posted, give the direct link instead
Track the last time a given nick was in the channel, and the last time they spoke
Queue a message for an offline nick that's automatically sent in-channel when they join
Use Google Translate to translate a given phrase
Post a given line to our channel's Twitter feed
Choose a random user and kick them (not the best idea depending on how unruly your channel is)
Pull the summary of a given term from Wikipedia and display it along with a link to the full article
Display information about any posted Youtube link (video title, length, submitter, votes, comments, etc.)
I'm also in the process of writing a bot in node.js. Here are some of my goals/functions:
map '#' command so the bot detects the last URI in message history and uses the w3 html validation service
setup a trivia game by invoking !ask, asks a question with 3 hints, have the ability to load custom questions based on category
get the weather with weather [zip/name]
hook up jseval command to evaluate javascript, same for python and perl and haskell
seen command that reports the last time the bot has "seen" a person online
translate command to translate X language string to Y language string
map dict to a dictionary service
map wik to wiki service
Again, this is an utterly personal suggestion, but I would really like to see eggdrop rewritten in Python.
Such a project could use Twisted to provide the base IRC interaction, but would then need to support add-on scripts.
This would be great for allowing easy IRC bot functionality to be built upon using python, instead of TCL, scripts.
That is very subjective and totally depends upon where the bot will be used. I'm sure others will have nice suggestions. But whatever you do, please do not query users arbitrarily. And do not spam the main chat periodically.
Make a google search to get a library that implements IRC protocol for you. That way you only need to add the features, those are already something enough to bother you.
Common functions:
Conduct a search from a wiki or google
Notify people on project/issue updates
Leave a message
Toy for spamming the channel
Pick a topic
Categorize messages
Search from channel logs