Хочу сделать команду !info, которая будет показывать дату создания аккаунта, с телефона/с пк и (то что как раз не работает) дату входа на сервер
@client.command(pass_context = True)
async def info(ctx):
args = ctx.message.content.lstrip('{}info '.format(config.get('config.prefix')))
if len(args) > 0:
try:
print(int(args.split('<@')[1].split('>')[0]))
user = await client.fetch_user(int(args.split('<@')[1].split('>')[0]))
member = await Guild.fetch_member(int(args.split('<@')[1].split('>')[0])) # Вот как я сделал
emb = discord.Embed(
title = f'Информация о {user.name}',
colour = discord.Colour.from_rgb(
color_neutral[0],
color_neutral[1],
color_neutral[2]),
timestamp = ctx.message.created_at)
emb.add_field(name = 'Дата создания аккаунта:', value = str(user.created_at).split(' ')[0], inline = True)
emb.add_field(name = 'Дата входа на сервер:', value = str(member.joined_at).split(' ')[0], inline = True)
if member.is_on_mobile():
emb.add_field(name = 'С телефона', value = str(' '), inline = True)
else:
emb.add_field(name = 'С пк', value = str(' '), inline = True)
emb.set_thumbnail(url=user.avatar_url)
await ctx.send(
embed = emb,
delete_after=float(config.get('config.time_before_delete'))
)
except:
await ctx.send(
embed = discord.Embed(
title = f'Ошибка',
colour = discord.Colour.from_rgb(
color_negative[0],
color_negative[1],
color_negative[2]),
timestamp = ctx.message.created_at),
delete_after=float(config.get('config.time_before_delete')))
else:
print(ctx.message.author.id)
user = await client.fetch_user(ctx.message.author.id)
member = await Guild.fetch_member(ctx.message.author.id) # Нуу это тоже самое
emb = discord.Embed(
title = f'Информация о {ctx.message.author.name}',
colour = discord.Colour.from_rgb(
color_neutral[0],
color_neutral[1],
color_neutral[2]),
timestamp = ctx.message.created_at)
emb.add_field(name = 'Дата создания аккаунта:', value = str(user.created_at).split(' ')[0], inline = True)
emb.add_field(name = 'Дата входа на сервер:', value = str(member.joined_at).split(' ')[0], inline = True)
if member.is_on_mobile():
emb.add_field(name = 'С телефона', value = str(' '), inline = True)
else:
emb.add_field(name = 'С пк', value = str(' '), inline = True)
emb.set_thumbnail(url=ctx.message.author.avatar_url)
await ctx.send(
embed = emb,
delete_after=float(
config.get('config.time_before_delete')
)
)
Выводит ошибку:
624301440973668352
Ignoring exception in command info:
Traceback (most recent call last):
File "C:\Users\ \AppData\Local\Programs\Python\Python37\lib\site-packages\discord\ext\commands\core.py", line 85, in wrapped
ret = await coro(*args, **kwargs)
File "D:\ \ \ \bot.py", line 789, in info
member = await Guild.fetch_member(ctx.message.author.id)
TypeError: fetch_member() missing 1 required positional argument: 'member_id'
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "C:\Users\Максим\AppData\Local\Programs\Python\Python37\lib\site-packages\discord\ext\commands\bot.py", line 903, in invoke
await ctx.command.invoke(ctx)
File "C:\Users\Максим\AppData\Local\Programs\Python\Python37\lib\site-packages\discord\ext\commands\core.py", line 859, in invoke
await injected(*ctx.args, **ctx.kwargs)
File "C:\Users\Максим\AppData\Local\Programs\Python\Python37\lib\site-packages\discord\ext\commands\core.py", line 94, in wrapped
raise CommandInvokeError(exc) from exc
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: TypeError: fetch_member() missing 1 required positional argument: 'member_id'
Говорит что я не написал аргумент member_id, но это ложь
member = await Guild.fetch_member(ctx.message.author.id)
Не предлагайте Guild.get_member, не работает