![]() ![]() We'll be using Discord.py to interface with Discord's API using Python. Return to your repl for the next section. Now that we've done the preparatory work, it's time to write some code. You should see that your bot has just joined. When prompted about permissions, click Authorize, and complete the CAPTCHA. On the page that appears, select your server from the drop-down box and click Continue. Paste the URL in your browser's navigation bar and hit Enter. Scroll down and copy the URL under Generated URL. Under Bot Permissions, mark the checkboxes labelled Read Messages/View Channels, Send Messages, and Attach Files. Under Scopes, mark the checkbox labelled bot. In the menu that appears under OAuth2, select URL Generator. Then follow these steps to add your bot to your server: In a separate tab, return to the Discord Developer Portal and open your application. Alternatively, open an existing server you own. Then click on the + icon in the leftmost panel to create a new server. You can't use a server that you're just a normal user on, as adding bots requires special privileges. We'll walk you through creating a test server for this tutorial, but you can also use any server you've created in the past, as long as the other members won't get too annoyed about it becoming a bot testing ground. Now that we've created our application and its bot, we need to add it to a server. Toggle it to the on position and save changes when prompted. Events involving users' actions and the content of their messages are considered more sensitive and need to be explicitly enabled.įor this bot to work, we'll need the "Message Content Intent", which will allow our bot to see the content of users' messages. Depending on a bot's functionality, it will require access to different events and sources of data. Second, we need to configure access to privileged Gateway Intents. ![]() What's more, bots on 100 or more servers have to go through a special verification and approval process, and we don't want to worry about that. We need to finish setting up our bot.įirst, disable the Public Bot option – the functionality we're building for this bot will be highly specific to our server, so we don't want anyone else to try to add it to their server. Once, you've done that, return to the Discord developer panel. Create a new secret with DISCORD_TOKEN as its key and the token you copied as its value. Return to your repl and open the Secrets tab in the left sidebar. The token you just copied is required for the code in our repl to interface with Discord's API.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |