This means that you can’t create a “Dreaming” activity for your bot to dream of electric sheep. For this reason many bots don’t change their status based on commands.Īnother limitation of the Discord API is that it does not at this time support custom statuses. In other words, if the bot is in many servers, its status will change in every server anytime a status change is triggered. One major issue with frequently changing the bot status is that Discord only supports a single status per server. This only updates when the bot starts, so for now it won’t update in real time as the bot is added to more servers. Now when the bot starts up it will automatically show how many servers it is a part of. # Startup def on_ready():Īwait client.change_presence(activity=discord.Game('Sea of Thieves')) Naturally, I wanted the bot to be playing Sea of Thieves around the clock.Īdding the following code in the on_ready function sets the bot’s status to “Playing Sea of Thieves”. The bot was going to be in a server dedicated to Sea of Thieves. This is particularly relevant to the bot I originally set out to build. Let’s start with one of the most common statuses seen on Discord, playing a game. In order to keep things simple, we’ll append the examples to the on_ready event. ![]() Setting the bot’s status when it first comes online will add a bit of polish while it is hanging out in the server. Watching: Use discord.Activity() with the type argument set to to show the bot as watching something Listening: Use discord.Activity() with the type argument set to to show the bot as listening to something Streaming: Use discord.Streaming() to display the bot as streaming with an optional url argument Provide the name of the game to the name argument Playing: Use discord.Game() to display the bot as playing a game. There are so many options for what a bot can do! There are a couple helper functions that we can use to build statuses. This method is used to change the bot’s status. The client object for the bot has a method change_presence. Using dotenv to Hide Sensitive Information in Python Hide your passwords and API tokens to make your code more If you missed the last post on how to use dotenv to hide your token, see the link below. Let’s update our bot’s status when it comes online to make it a bit more lively. You can write about them in the comment section below.Looking at the latest iteration of our Discord bot, it isn’t very exciting. In what situations do you prefer to appear offline on Discord? We would love to hear your story. When you change your online status, it applies to all the devices where you log in to your Discord account.
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |