Skip to content
Advertisement

How to make this command work with all users

guys my command only working for my bot, can someone help me?
to explain better:
*fake @mybot blabla (works)
*fake @SrWonka blabla (dotn work)

Code:
Soucebin:https://sourceb.in/rkhH6YdTCx

JavaScript

Advertisement

Answer

Changed made:

  • The way you were getting your user is not the optimal way I used Typing.union you can see the docs below.

  • display_name it will show the nickname if there if not then it will show the username.

  • discord.utils.get to get the webhook instead of looping

Here is the code edited:

JavaScript

First was for another user.

Second was for the bot itself.

enter image description here

Docs:

typing.union

A typing.Union is a special type hint that allows for the command to take in any of the specific types instead of a singular type.

Member.display_name

Returns the user’s display name. For regular users this is just their username, but if they have a guild specific nickname then that is returned instead.

discord.utils.get

A helper that returns the first element in the iterable that meets all the traits passed in attrs. This is an alternative for find().

User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement