'member is a required arg that is missing
I have a problem with my bot because I don't want to load certain variables that are specified. If you see any errors in the code, I'd be very grateful if you could help.
Error: discord.ext.commands.errors.MissingRequiredArgument: member is a required argument that is missing.
Here is code:
#!/usr/bin/python
import os
import discord
from discord.ext import commands
from discord.ext.commands import Bot
from dotenv import load_dotenv
load_dotenv()
TOKEN = os.getenv('')
bot = commands.Bot(command_prefix = "/")
client = commands.Bot(command_prefix = "/")
@bot.event
async def on_ready():
print("----------------------")
print("Zalogowano jako:")
print("Użytkownik: %s"%client.user.name)
print("ID: %s"%client.user.id)
print("----------------------")
@bot.command(name='tutorial', help='Tutorial')
async def tutorial(ctx, member: discord.Member):
message = await ctx.send('flag_gb In which language do you want to receive the instructions?')
message = await ctx.send('flag_gb W jakim języku chcesz otrzymać instrukcje?')
flag_pl = 'flag_pl'
flag_gb = 'flag_gb'
await message.add_reaction(flag_pl)
await message.add_reaction(flag_gb)
def check(reaction, user):
return user == ctx.author and str(
reaction.emoji) in [flag_pl, flag_gb]
member = ctx.author
while True:
try:
reaction, user = await client.wait_for("reaction_add", timeout=10.0, check=check)
if str(reaction.emoji) == flag_pl:
em = discord.Embed(tittle = "flag_pl", description = "**1**")
em.add_field(name = "Opcja 1", value = "Link" );
await member.send(embed=em)
if str(reaction.emoji) == flag_gb:
em = discord.Embed(tittle = "flag_gb", description = "**2**")
em.add_field(name = "Opcja 2", value = "Link" );
await member.send(embed=em)
except:
print("Wystapil blad!")
bot.run('TOKEN')
Solution 1:[1]
discord.ext.commands.errors.MissingRequiredArgument: member is a required argument that is missing means that you have to put the name of the member after the command (e.g. /tutorial user123 instead of /tutorial @user123). Also, an error you made is in
flag_pl = 'flag_pl'
and
flag_gb = 'flag_gb'
The emojis in discord always begin and end with :, so it should be
flag_gb = ':flag_gb:'
and
flag_pl = ':flag_pl:'
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Wasi Master |
