Set Custom Discord Status when running/starting a Program - python

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.

Related

Best way to create a script to automate a simple process using selenium?

Ok, so I'm a total noob with aspirations of learning to code. I've read about a guy who, for example, wrote a script which, if he was at work past a certain time, would automatically send a text to his wife stating he would be late. I want to do something sorta similar.
What I want in essence is a script that will log in to a website at a certain time of day, check if a box/text is green/yes or red/no, and send a text or notification to my phone informing me of the result each day.
The progress I've made so far is installing Python, installing PyCharm and done some research about tools I could use toward achieving my goal. Selenium seems like it would be capable of logging into the website, but I've no idea how to go about setting up a conditional statement to check the result, nor how I could set it up to send a text/notification to my phone. Also, if there is a more appropriate tool I should look into rather than Selenium and Python, I'm not attached to the idea of using these specific tools.
Finally, I realize that this may end up being too complicated for a first project, so I'd be up for hiring a freelancer to set this up. Equally, if this is something that could feasibly be written by someone with very little knowledge of coding such as myself, I'd really appreciate some direction from an expert!
Thanks for any input!
You are on the right track with selenium for web form automation. Sending notification however would require something else as was pointed out, and if you're on windows you can use windows task scheduler to automate, to performed only on certain time of day etc.
To make things more simplified, you can also look up general purpose automation programs that might support all these features together. For example, JRVSInputs uses selenium for web auto-fills https://jrvs.in/forums/viewtopic.php?t=182 and have features to send email or windows notifications. It can convert all its scripts into a neat batch file, you can then automate this batch file in the task scheduler.

Discord.py - Message, which only one user can see in the server

I'm making a Discord bot in Python and I want to add a feature, when message can be seen only by one user.
I made an example from Dank Memer bot. Any ideas?
These are called Ephemeral messages, however, they can only be used in response to an interaction. Examples of interactions are things like slash commands (like mentioned above), drop-down menus, and buttons.
Unfortunately, the current version of discord.py does not support interactions, so you will have to use a different library.
You can check out some cool libraries for interactions. I would personally recommend discord-components, but that's just my opinion.
You can now do this, for anyone googling:
await interaction.response.send_message(f"only you, {interaction.user}, can see this!", ephemeral=True)

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

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.

Is there something like onFirendRequestAccepted?

I'm starting to work with discord API via discord.py module. I've been through docs, but I've not found anything like this.
So, here's the question:
Is there some event trigger like onFirendRequestAccepted which runs the function when someone accept your friend request?
The below is outdated since v2.0 of discord.py, which removes the 3 events listed.
Old answer:
The rewrite branch contains on_relationship_add, on_relationship_remove and on_relationship_update.
http://discordpy.readthedocs.io/en/rewrite/api.html?highlight=friend#discord.on_relationship_add

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