Python how to trigger a code when something from another program happends - python

i want to use python3 to make a "chat bot", but, i don't want it to be complex, i just want it to say something when someone enters the chat room imvu. Any ideas where to get some docs to read or something? Would be nice. Thank you all.

I recommend watching the YouTube channel called The Coding Train because he has done a few things with chat-bots and twitter-bots. If that's not what you're looking for do a few quick google searches on the subject "how to make a chat-bot" or something like that. there's a lot of material out there.

Related

Perform keypress on audio cue. Is this a simple program?

This is my first post and I am very new to Python so please excuse if I ask something a little daft.
I am thinking about trying to make a simple script that can complete a keypress upon hearing a certain audio cue. Is this an easy task or is this something that requires advanced knowledge?
Much appreciate any input.
Many thanks,
Phil

Set Custom Discord Status when running/starting a Program

I am working on a application, where it would be cool to change the Status of your Discord User you are currently logged in to. For example when i start the appplication then the Status should change to something like "Playing Program" and when you click on the User's Status then it should display the Image of the Program.
Now i wanted to ask if this is somehow possible to make and in which programming Languages is it makeable?
EDIT: Solved the Problem with pypresence
The question is not if a certain programming language can do this, but if the Discord API can do it or if you have to use other ways than the official API.
I would advise you to take a closer look at https://discordapp.com/developers/docs/intro first.
In your startup, where DiscordSocketClient is available, you can use SetGameAsync(). This is for C# using Discord.NET.
To answer your question, I think any wrapper for Discord's API allows you to set the current playing game.

Python Ask.fm IP of Anonymous Questions

I got much anonymous questions that attack my friendship.
Is there a way to get the IP-Adresss of these Questions with a Python script?
I have little more than normal Python knowledge, so you mustn't show me complete Code, just 1-5 lines or just explain something.
I hope you'll help me!
If the IPs are not logged by ask.fm, there is not much you can do about it. And if it's logged, you probably don't need any script to extract it, as it should be presented somewhere along with the questions or separately in some list.
In addition to #Michael's answer, even if you might be able to get the IP you won't be able to do much. Most of people also use dynamic IP addresses.
You may want to contact ask.fm to get more informations, it's very hard they will give you them though.

Using Python to tie together a DLA AI

So, I am completely new to programming. I've been learning basic Python over the last couple weeks. I've always wanted to learn a programming language but right now my primary reason for delving into it is to Create an AI program for my man cave. Here are my Ideas which I am sure have been thought of many times before. They are just my goals:
I would like to take a pre-established open source chat bot and tie it to a Natural Language process to give it the ability to convert my speech to a text command that it can execute and at the same time take its text output and filter it through an audible speech sample (very much like SIRI). This way when I have the function of Natural Language response on, I can have basic conversations with it. I can also turn the conversational aspect off via a voice command so that the only thing it responds to is direct commands (e.g. "Gerard, please open an email, execute. Recipient, logan.wolf.ypher#gmail.com, Subject, Hello World, Body, insert text i speak.)
I would also like to have it recognize that I am there when my phone attempts to connect to the wifi.
I know that this may be a bit complicated for me at the moment but I hear the best way to learn a language is to jump on into a project you enjoy.
Does anyone have any pointers on where to start looking for a base AI or just any tips in general that you wish to give me? I'd appreciate the info very much. Thank you.
-Logan
Considering that So, I am completely new to programming, I would recommend you take a smaller part of this project and successfully implement it. For example, an email account which is checked every 1 minute and you can send textual commands to it. From there, start upgrading it to use chat, cell phone, speech-to-text, and lastly, AI. I only say this because I know the diffulculty of starting a too-ambitious project when I am new at an area (electronics, engineering, programming, language, etc...) and fail. Success, even in small steps, is better!

Python IRC client: write from scratch or write plugin for existing framework?

For our company I'd like to have a Python based IRC bot which checks whether the websites of our clients are still up and running. More specific: I want to list a number of URL which should be visited every, say, 15 minutes. If it fails, the URL should be checked again after 5 minutes. If retrieving the URL still doesn't result in an HTTP status code 200, it should echo the failing URL in the channel so we can investigate it.
I've written a plugin for Supybot some time ago that basically does some of the above in a crude but effective way. If I want to expand the functionality of the current code to the above 'specs' I need to do some major refactoring; basically it would mean starting from scratch.
Which raises the question: should I write a better plugin for Supybot, matching the new requirements, or go for something else altogether? Should I start from scratch (learning the most, implementing the relevant RFCs myself, spending more time than planned) or is there a suitable framework which handles the basic IRC stuff?
I vote for a completely new plugin for Supybot. Learn more ;)
If you won't do so much, try python irclib. It's a (still maintained) python lib for IRC.
Twisted may also be ok, but it's a little but too much...
To me it sounds like a case of your application wanting to talk IRC, and my gut reaction would be to use Twisted, which has IRC clients. This may or may not be the right solution for you, but at least it's worth investigating.
I finally decided to create use Twisted for my bot. As to the why:
Supybot already has a lot of functionality. And that can be a good thing: just create a simple plugin, hook it up and start using the bot. The downside is that you may not like some of the functionality already provided for. As an example: I didn't like the fact that it responded to everything (Error: "foo" is not a valid command.). I'm sure it can be turned off somehow somewhere, but these kind of small things bothered me.
The Python IRC client library on the other hand felt a little too bare bones. Especially since I needed threading to have the bot check a whether a number of websites are still alive while remaining responsive in the channel.
If the irclib felt like too low level, writing a bot from scratch would certainly be. While I definitely wanted to learn something, I also wanted to focus on the actual functionality of the bot, without being bothered too much by the 'basic' stuff (e.g. I don't necessarily want to write the code to identify the bot, I like to just have some configuration setting to store the nickname and password and handle this for me.)
Twisted has a nice example of a logging bot which can be used as a starting point. Furthermore: in the future it should not be too hard to write a small webserver (using Twisted obviously) to display the output of the bot.
Tip: besides the Twisted documentation you can also take a look at the October 2008 issue of Python Magazine for the article "A Twisted Logging Server" by Doug Farrell.
Thanks to the ones who answered the question. You set me on the right track. :)
Writing a simple IRC bot isn't that hard. I have a template I keep using for my bots, which range from SVN bots to voting-status bots to bots which check connections to certain IPs and change the channel's topic according to the result.
I can share the source if you'd like, though there's nothing like writing your own :)
irc3 is a plugable irc client library based on asyncio and venusian https://irc3.readthedocs.org/

Categories

Resources