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:
- Created 5 years ago
- Comments:7 (3 by maintainers)
Top 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 >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
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 yourserver
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 throughctx.message.server
.Connecting these pieces together, the solution to your problem is to:
ctx.message.server
to get the Server instance, rather than attempting to access the dataclass.@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.’