Discord.py how would I add a command to clear out a certain amount of messages from a channel - discord

I am looking to add a feature to my basic bot that will purge a number of messages in the channel
i.e
!purge 50
Will then delete 50 messages from the current channel.

You can do this really easily. Using purge, you can make this command.
By the way, please look at the docs before asking a question here. It would save everyone time.

Related

Can anyone give a script specific to deleting messages in a specific channel from a specific role

I am not personally very adept with knowing how to make script commands I wondering if anyone knew exactly how to make a command where I can get a bot to delete messages from a specific role if they happen to try to message in a sirten channel.
I tried to look around the options for the bot commands but I was lost in trying to figure it out

Discord Auto Respond C#

I was wondering if anyone knew how to, if possible, make a simple bot that just responds to DM's sent to you. For example, if a friend DM's you, a bot responds with something like
"This is an automated response, hang in there and I'll soon respond."
Thanks in advance.
Previously answered in Auto-reply to direct messages
It's against Discord's TOS https://support.discord.com/hc/en-us/articles/115002192352-Automated-user-accounts-self-bots-
Hopefully in the future, they create some small feature that just gives a basic response. Though, it is understandable why they don't want this as it could cause a lot of spam DM's and fake "people" hopping into your DM's.

Discord.py clone my voice to other channels

Is there anyway I can create a bot using discord.py that joins my voice channel and share what I'm saying or whatever is playing to other voice channels in my server and other servers as well?
First of all, larger bots like "Groovy" or "Rythm" allow use in multiple channels as they can be run on a completely different shard for each server, meaning it can be used and commands run to function in each and every server.
It seems in your case, it would not be able to do this, as it would be able to join multiple channels but can only have usage in one channel at a time.
I have found only Discord.js has a feature like this, but similar, it records user voice and saves it as an MP3 file.
The Discord. js voice system allows your bot to join voice channels and play audio. The main part is, Discord does not officially support Discord bots receiving audio see here, so there may be some breakages.
Obviously, you aren't using JS so this would not be possible, or at least very difficult to make. But hope this helps in some way.

What defines a message as 'cached' in discord.js

As we all know, in the change from v11 to v12, cache was introduced, however I can't find anything online that explains exactly what it is as a concept. Can anyone explain how it works?
I have just taken a look at the D.JS source and thankfully it is heavily commented.
In many files it suggests that any message that is sent by a user, or any message mentioning a user caches said user. This works in the same way with guilds I believe.
This means that in order to find a user in a server using #get or other fetch methods, the user must have been mentioned, or typed a message.
BaseManager.js source file here
Client.js source file here
GuildManager.js sournce file here

Organise files for multiple mini-games for Discord bot

EDIT : (rewrite)
So, I'm doing a mini-games bot for my discord server. I have already done a bot with multiples features and it was organize like that :
- My main was handling my events. I was checking where my event was called and according to the channel, I will run my corresponding file.js.
- I have my main folder, with inside, one folder with my commands, one with my "handler" (like members counting, and other autonomous things), and the last one with my images.
Do you think it's correct, bad, and what can I improve ?
Can you send me your idea or your point on vue on that.
I try to make my code better each time I code, and organization is one of the thing I want to improve.
I hope it's a much more understandable.
Please read the handy DiscordJS Guide that covers this subject and maybe put a little more effort into your research next time: https://discordjs.guide/command-handling/#individual-command-files

Resources