Show Discord bot as online - discord

I'm working on a custom Discord bot using their api. Sending HTTP requests work but the bot doesn't actually show itself as online.
Other bots such as Dynobot are able to show themselves as online, am I missing something or is it just a case of how many requests are sent?

Wait, are you working directly with the API, as in sending HTTP requests?
If so...there really is no need to do this. Instead, use a library to code your Discord bot. Here is a list of official libraries for the Discord API. Personally I recommend Discord.js, although I have heard that Discord.py and Discord.NET are also good.
If you want to keep using the API directly, which I do not recommend at all, I believe you can call /api/login. Have you tried that yet?
I hope this helped! :)

Related

Discord Bot Trigger on Webhook Received

I am trying to pipe notifications from various online services into a Discord server using Webhooks. The problem is, discord doesn't render the message that is received by a webhook the way I need. It omits some information that I would like to display.
Is it possible to receive the raw JSON information from a webhook when it arrives, then process it and post into a channel?
My thinking was: I can create a new bot, then subscribe to some kind of webhook_message_received event and process it the way I want. Turns out, there's no such event (or I don't know where to look).
There's not much information online, so I would appreciate any advice.

Using Discord Bot To Display Youtube Video

I want my discord bot to send basic youtube embeds that appear automatically when a link from youtube is pasted on discord by a user.
I do know i need to install and use pytube for this.
Just need some direction on how to connect my bot to youtube.
(I'm new to discord.py)
For example i do !yt mango and the bot sends the top 3 results that come when searched for mango on youtube.
Please help me out
I want my discord bot to send basic youtube embeds that appear automatically when a link from youtube is pasted on discord by a user.
auto-embeds is a default functionality of Discord. When someone posts a link and you have auto-embeds enabled for the server you will be able to watch the YouTube video from the Discord client.
I do know i need to install and use pytube for this.
pytube is for downloading YouTube videos. You don't need to download the video. Thus pytube is not needed.
Just need some direction on how to connect my bot to youtube.
(I'm new to discord.py)
Familiarize yourself with discord.py first. Here is the manual:
https://discordpy.readthedocs.io/en/stable/api.html
Get a basic discord bot running before attempting anything more advanced.
For example i do !yt mango and the bot sends the top 3 results that come when searched for mango on youtube.
To be able to search on YouTube you need Google API. Refer to: https://developers.google.com/youtube/v3/quickstart/python
Here is a possible library you could use: https://pypi.org/project/python-youtube/
On StackOverflow we don't write code for you. We can only guide you in the direction but you have to write the actual code yourself or be more specific with your problem. Break your big problem into smaller tasks and solve those.
StackOverflow is more for debugging faulty code.

Giving a webhook a name Discord.JS

I like using webhooks, and I think they work amazing, but what I can't figure out is giving a webhook a certain name for just one message.
You can do it by setting username in the JSON you send to Discord. The full documentation is available here: https://discord.com/developers/docs/resources/webhook#execute-webhook-jsonform-params

Retrieve data from post webhook using React

So this is a more general question and I did not know who to turn to. I have configured a webhook using from a live streaming third party platform I am using. I did this using Golang and tested my webhook I am getting the POST data how I want. Now the problem is how do you get this data back on the front end. I have looked into setting up websockets and server side events. They both don't make too much sense to me as I see the work on the front end should be pretty straightforward. I don't think I should have to configure another endpoint to get the webhook data and it doesn't listen to the webhook async anyway so I don't think that will work. Any help please...

How to delete all channels In a discord server(js)

I am attempting to delete channels on my discord server using my bot and this is the code:
if (message.content === 'tanbu')
message.guild.channels.forEach(channel => channel.delete())
.then(console.log)
.catch(console.error);
the error is :
TypeError: message.guild.channels.forEach is not a function
What do I do?
This would've worked in Discord JS V11, but not in V12.
This is what you're looking for:
message.guild.channels.cache.forEach(channel => channel.delete());
https://discord.js.org/#/docs/main/stable/class/GuildChannelManager?scrollTo=cache
Maybe you should think twice before doing such actions. Because this leads to violation of the Discord tos. And it even spams the discord api. which could lead you to a api ban to a particular endpoint or globally sometimes. Even if the library has ability to slow down it , you could still easily bypass it. The ideal solution here is using a sleep function , and not using a forEach loop, maybe a for loop would do better.
Still this is not recommended doing , if your intention is to nuke servers.
I believe that that is for raiding and self bots witch is against discord TOS
i defiently would think w

Resources