![]() import discordĪwait (file=discord.File('sample-mp4-file-small.mp4'))Īwait (file=discord.File('file_example_MP3_700KB.mp3'))Īwait (file=discord.File('sample.pdf'))Īfter running the code when we type “video” in the channel the bot will respond with a video that we had given in the file and similarly for audio and file i.e. Here is the code to send video, audio, and files through the bot. And also we need to keep that file in the same directory where our code is there. To get the video, audio, and file through the bot, we must share the file name in the file section for the file that we need to share through the bot in order to acquire the video, audio, and file through the bot. Step 9: Get the video, audio, and file through the bot. import discordĪwait (file=discord.File('download.jpg'))Īfter running the code when we type “image” in the channel the bot will respond with an image that we had given in the file. It could be done by running the given code. We need to give the file name to it and the file should be in the same directory where our code is. The image could be sent through the bot in the form of a file. When you type “hi” in the channel, the bot will respond with the “Hello!” message. Print('We have logged in as def on_message(message):Īfter running the code, the bot that we had built will come online to respond to our messages. import discordĬlient = discord.Client(command_prefix='!', def on_ready(): Step 7: Get the text response from the bot. After that select the server to which you want to add your bot, allow permission to the bot and add the bot to your server. Now scroll down and in the bot permission select the following permission. Step 5: If your bot is not verified, you can toggle those intents below to access them. Step 4: After the bot is added to your channel copy the bot token. You will have to confirm by clicking “Yes, do it!”. Step 3: Go to the “Bot” tab and then click “Add Bot”. Give the name to your bot and then click on create. Step 2: Now go to the discord development website. Step 1: Create an account on discord by visiting the website, and also create a server and a channel. Here we learn how we can get the following responses from the bot: How we can send text, image, video, audio, files through the bot, and further when we send any file to the channel how we can get it at the server-side in our computer. In this tutorial, we will learn to create a Discord bot and add it to our channel. Discord is a group-chat platform similar to Skype, TeamSpeak, or Slack that allows users to communicate simple text messages as well as rich messaging. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |