question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

discord.Server.member_count, .created_at etc don't work for me

See original GitHub issue

@bot.command() async def createdat(): server = discord.Server time = server.created_at await bot.say(time)

The above code returns no errors but only says in discord: '<property object at> ’ followed by a string of numbers and letters. Can someone explain why it isn’t returning a date/time? (i also put in member_count as that also does the exact same thing)

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
Gorialiscommented, Apr 8, 2018

Please don’t copy and paste code around from the example sources. They serve as an example to make you understand how to structure your own code, not as a direct implementation resource.

The command linked does not serve the purpose you were originally trying to in your own code. Your original issue is that you assigning the discord.Server dataclass to your server variable when you actually want an instance.

Instances relating to the current context can be found from the Context instance that is optionally passed to commands. An example of a command passing context is shown in the example here.

From the How do I get the original message? FAQ entry, we know that when we pass context, we can use ctx.message to get the original message. Since this message is tied to the server, it has the Message.server attribute, so the Server in this context can be found through ctx.message.server.

Connecting these pieces together, the solution to your problem is to:

  • Pass context using the keyword argument in the decorator (see the example)
  • Use ctx.message.server to get the Server instance, rather than attempting to access the dataclass.
0reactions
tom-pettitcommented, Apr 8, 2018

@Tarek1337 i tried that and it still came up with the same error: ‘raise MissingRequiredArgument(’{0.name} is a required argument that is missing.‘.format(param)) discord.ext.commands.errors.MissingRequiredArgument: member is a required argument that is missing.’

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to Setup Member Count Bot on Discord (Server Stats)
This tutorial will teach you how to setup the Member Count Bot on Discord to display your server stats. The bot will show...
Read more >
I want to get members count in discord bot but it gives error
I ran the code and it's working as expected. ... var memberCount = guild.members.filter(member ... iconURL() }) message.channel.
Read more >
How to Show Member Count in Discord - Alphr
Head to the website of the bot you want to add. Tap the button to invite the bot.
Read more >
Total Member Count - Discord Support
Just a good way of showing how many server members there is without having to count or see the invite.
Read more >
Disabled for DMing, etc... - Discord Support
Hi, I'm a server owner of a 900+ server of which I worked hard to reach that member count through something called partnerships....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found