In my Discord bot, I'm trying to develop a "lockdown mode", where the owner and 3 admins send a bot-generated code to trigger a lockdown, where all members of the server except moderators and the bot are kicked. I have the first part done, now I just need a way to kick everyone in the server except those with a specific role. I can get the role ID, that's not a problem, I just need the code for kicking everyone except a role.
Thanks,
MrConorAE
The only way you can kick everyone from a guild (barring very small guild sizes) in the manner you propose, would be to delete the guild entirely.
There is no way you can achieve kicking large amounts of members within a small period of time, as such an action would spam the Discord API, and result in the termination of your bot.
The best way I could see a 'lockdown mode' being achieved would be to have to bot change the permissions of the general role of your server (whether it is everyone or a Members role) to have permissions to do nothing in you server, and to view none of the channels. This is the only way I could see this result being achieved in a somewhat non-API-spammy way, but to simply kick everyone from the guild, is a task not achievable on a server that has more than ~10 members.
Related
Sort of a follow up to my other question but, I am making a slash command that'd make a role with customisable permissions, customisable colours, and a customisable place up in the Role Hierarchy.
I've seen that it isn't possible to make a role that is higher up on the Role Hierarchy if the bot is lower than the role you want to put it above, unless done by a member with MANAGE_ROLES and a high role but, is it actually possible to make the bot do this or not?
Any ideas?
P.S: I have seen bots that, upon invited, request that you put their role at the top of the list. I might make something like that for my bot.
Is it possible to make a bot to automatically message people in my friends list or everyone from a specific server where i'm not an administrator? Where would i start, i know some Python but never worked with Discord bots, i was thinking this shouldn't be too hard as a first one?
I know i've received various messages / adveritsements from people on discord that i wouldn't think are admin on any server i'm on. Unless its done manually?
If you are wanting to write your own Discord bot in python, have a look at discord.py, follow the tutorial which will show you how to write simple commands and automated responses.
Is it possible to make a bot to automatically message people in my friends list or everyone from a specific server where i'm not an administrator?
You must have the required permissions to add the bot to the discord server. A role with 'regular' permissions will typically not allow you to do this. Additionally you can only have discord bots bound to a server, so a 'personal' bot that follows you around different servers is not really feasible.
I think what you're talking about is a self bot, which is against the Discord TOS and will likely get your account banned. If you want to get a bot on a Discord Server you'll have to ask an administrator.
I want to have a Discord server for paid members. I thought I could make them pay over Stripe, send them an invite on payment, and then regularly run a Python script, which checks whether all my Discord members have a valid subscription. For this to work I need a logical connection between the payment and the Discord member.
I thought the logical connection would be the invite, but I can't seem to figure out how to do this. I studied the Discord API, but it seems the invites are not unique to members nor I can track down which members used which invites.
Also, I can't even see the members' e-mail address. Not that e-mails would be the best logical connection, as one could use a different e-mail for subscription than for setting up their Discord account, but it would be at least a spark of hope. I discovered a permission/scope to see e-mails, but it seems to require a full, interactive OAuth2 flow, whereas I need to pair the members with payments using a non-interactive server-side cron script.
Could someone point me to the right direction?
Note: There are services like LaunchPass or Memberful, which can do this, hence there must be a way. I can code and I think I'd be okay with a much simpler mechanism then what they offer (one manually editable Google Sheets table and one Python script), so I'm trying to figure this out myself.
Another option would be to create a single-use invite once the user completes the payment and send it to them. It'll be unique to them, and it'll get invalidated once they join. When they join, you can record which member joined using this invite and cross-reference the payment which caused the invite to be created and the member who used it.
For bonus points, you can see if the member leaves and email them another invite to join the server back.
A drawback of this solution is that this does not prove that the member who joined is the member who paid, and they can transfer their invite to somebody else and their username will get associated with the payment, but that would require actions on behalf of the person making the payment.
I am an admin for a small group discord server we use for among us. when playing between games we need to batch mute a whole voice channel as a lot of users in the voice channel cannot use push to talk. would it be possible to create a bot to batch mute all users in a voice channel, without affecting other channels (we sometimes have 2 simultaneous games) without having to go in, right-click a user & select server mute?
As a side note, I do not want to use any mute roles as a solution because any new role permissions only come into effect after a user leaves and rejoins a voice channel (which would not be possible for users on phones, needing to stay on the among us app)
I am very new to discord adminning (is that a word?) and have no prior bot experience but if there is any simple bots to add to the server it would help.
Thanks for any help!
This is indeed possible. You will first need to narrow down what
language you're interested in working with for this bot (I recommend
Python, Javascript also works well)
The documentation for Discord.py is extremely good. If you're
comfortable with Python, I'd say just jump right into it.
discordpy.readthedocs.io/en/latest/#documentation-contents You can
just skip the "Migrating to v1" section because it's not applicable to
you. You'll also want to actually make the Bot account:
discordpy.readthedocs.io/en/latest/discord.html
There are also no shortage of youtube tutorials for Discord.py. I've
never seen one I thought did well but they might help you understand
the basic structure of a bot script before you start searching the
API.
– Allister
I have a joke Discord bot which automatically nicknames people for the main server it's on, but I also allow some other friends to put it on their server for fun. The only issue is, the automatic rename thing also happens there.
What would the correct line of code be to make it so the lines of code responsible for the auto-nickname feature only run when someone joins a specific server and not any server with the bot?
Each guild in discord has a guild ID, witch is unique, so you could use it to determine if the bot should do the nickname change in that specific guild.
I can't show you an exact line of code since you didn't specify the language you are writing your bot in but I'll write the basic idea of it.
if (message.guild.id != "Your main guild id") return;
This assumes that you execute this on a per message basis, but since you didn't provide much more detail this is as much as I can give in terms of code example.
Another thing to consider is how to get the guild ID in the first place, firstly enable development mode in discord in case you haven't already, to do that you should:
Open your Discord settings
click on Appearance
Scroll down to Developer mode and enable it.
Once you did that, you can right click the server name and go to "Copy ID", and you have your id.