How do I mass-delete channels on DIscord.js? - discord

I'm making a bot that manages servers, and I would like to know how to delete all channels currently in a server with a single command

message.guild.channels.forEach(channel => channel.delete())
Source: Discord.js - Deleting all channels in a server

Related

Discord Py Running Command from Server

This might be a duplicated question! sorry I couldn't find an answer!
I have a bot running on a linux server "using discord python lib". I want trigger a command from the server side as a cronjob. Is that possible with the way Discord events are designed? The command needs to run every 5 mins!
I have a db with user/payment data. The command should check if the userid has sent payment. If so then assign them a specific role. Otherwise if the user's payment data is false remove the role.
Right now this works fine with a command I wrote "update_payment" however this command has to be triggered from the discord server manually. I don't want to run this by hand every 5 mins. How do I trigger it from a cronjob on the linux server?
You can use tasks.loop to loop your task:
from discord.ext import tasks
#tasks.loop(minutes=5)
async def update_payment():
pass # whatever here
update_payment.start()

Check discord bot shard (connection) status

Using discord.js (v12), is there a way to check a shard's status? For example, "reconnecting", or "resuming". I could not find a way to do this, please help.
I don't use shards, but in my bot I have the debug log enabled:
bot.on("debug", info => console.log(info));
This gives a heartbeat for each shard every minute and tells you if and when the shard connects & how many servers it's able to connect to. Even without different shards for my bot I think it's pretty handy and it may help you.

Is it possible to show by command how many voice channels my Discord bot is currently connected to?

I would like to display via command how many voice channels my bot is currently in, is this possible? Maybe also with extra things like the server ID/channel ID. This is not needed though, just the command and the amount would be good.
I already found a method for js but not for Discord.py.
You can use the Bot.voice_clients attribute
voice_states = bot.voice_clients # or client, however you named your instance
await ctx.send(f'I am currently in {len(voice_states)} voice channels')

Is there an option to connect multiple bot accounts to a one discord.js code?

I'm creating a mass of bots that would ping me just to beat world record in pings so I decided to create 20 bots but now I'm wondering if it's possible to connect one code to multiple bot accounts.
Somewhere in your code there should be
const client = new Discord.Client();
Instead make an array
const clients = [ new Discord.Client(), new Discord.Client(), new Discord.Client()];
And everywhere you used your client variable make a loop for every client in the array instead.
The way you're describing, to my knowledge isn't possible but there is another way. Just make every one of the bots have the same prefix and command so when you run !ping for example, all the bots would respond. So just copy and paste all the same code into each bot.

Discord bot to check if a minecraft server is online

I was wondering if anyone knew of a discord bot that will send a message in a discord sever when a minecraft server is online and send a message when it goes back offline
I've done some googling and can't seem to find one that does what I want there are a couple that u have to manually type commands for and others that appear in the sidebar of discord I simply want one that will do it automatically is there one that exists like this already?
I didn't found any not that already did this, but you can do this pretty easily with the Discord API.
Here is a a script I found that send a message to the server : https://gist.github.com/ianklatzco/769d9e3a991dc2f443a2e105b0157117
You can adapt it to ping the server in a if statement to send if it is online or not
(This script is in python but the Discord api works in more languages)

Resources