
import discordĬlient = commands.Bot(command_prefix='!', def drtmsg(ctx, user:discord.Member, *, message=None):
#PYTHON FFMPEG DISCORD CODE#
Let us look at a code that sends a DM when the designated command is used. The role_error function is used to print an error message in case an unauthorized user tries to assign a role to another user.Ī lot of Discord servers are configured to send a welcome message via direct message when a user joins the server or to send a warning if they violate any of the server’s rules. We then use the add_roles method to add a function to the user.īased on the requirements, you can allow multiple roles to be assigned to a user or use if-else statements to only allow one. To add a role, first, we use the commands to ensure that the user trying to add the role is authorized to do so. If isinstance(error, commands.MissingPermissions):Īwait ctx.send("You are not authorized for this action") Various versions of the API are in use, you can use the preferred version by adding it to the request path such as to def role_error(self,ctx,error): The API is an open API that can be used to serve requests for bots and OAuth2 integration. The Discord API allows for simpler and deeper integration with other services that enable users to have a smoother user experience. This is only possible for unverified bots that are a part of fewer than 100 servers.įor verified bots, privileged intents need to be requested.

To give your bot access to privileged intents, you need to enable ‘Privileged Gateway Intents’ in the Developer Portal under the bots section. Now, add a bot and after naming it, copy the token for further use.Ī Discord bot may need to access data that Discord qualifies as ‘sensitive’ in nature. Name this application and click on the option bot from the list on the left side. Go to the Discord developer portal at, log in, and click on ‘New Application’.

If you have some time to type a comment, could you help me on that one ?įile "C:\Users\Lou\AppData\Local\Programs\Python\Python38-32\lib\site-packages\discord\ client.py ", line 343, in _run_eventįile "c:\Users\Lou\Desktop\Python Bot\ main.py ", line 68, in on_message

I tried using ffmpeg, adding it to path, just giving the file path without ffmpeg.

Hello, I'm currently trying to make a discord bot using discord.py, and one of the features I'm trying to implement is playing music in voice channels.
