Discord.js - Send a message when a channel is deleted - node.js

Just wondering if it's possible to send a user a dm with a bot when a channel is deleted.

Yes, it is, using client events. This question is quite vague and non-code specific so you should head to the Discord.JS discord server for questions like this (avail. on their website).

Related

telegram bot auto leaving from channel

hi all i'm new to telegram apis and bot, i'm having some troubles with my bot: i setted it, got my token and it can become the admin of the channels i do need to admin with it. just the bot every now and then just leave the channel by itself when another administrator of the same channel in whitch it is in posts a message or invite a new user to the channel. does it make any sense to you? is there a solution to keep it in charge of the channel?
other infos: i program in php, the bot is needed to post messages in telegram via a web site programmed in php
i would apreciate a real answear and not just a paste of the link to telegram bot documentation
thanks a lot

Discord bot that sends messages recieved from webhook

I am trying to make something that will send a notification to my phone via discord when a webhook is called. The notification should have a body of text, and could be something like a python error, or just some plain simple text like "hi there".
I built a discord bot that uses an overridden python BaseHTTPRequestHandler, running in its own thread, which sends the server messages via client.loop.create_task(self.get_channel_by_name(name).send(message)). However, it is pretty slow (takes a few seconds to half a minute to go from webhook to server message, when it really should be almost instantaneous)
I'm thinking I have taken the wrong roundabout method for building my webhook discord server, but I have no idea the right way to go about this, and though I would ask the community. Any thoughts on how to go from requesting a specific file like "http://localhost:8000/post/category/channel/encoded-message", to the specified message in my discord server in a specific channel in a given category? Thanks for any advice!
I figured it out after a bit of googling. Here[https://discord.com/developers/docs/resources/webhook#webhook-object-webhook-types] is the discord api for creating bots using webhooks. The trick is you go to the channel of the server you want to send messages to, and in the settings, add a webhook in the intergration tab. No need to mess around with the discord python package. I managed to start sending messages using python requests library, and nothing else.
import requests
requests.post(f'https://discord.com/api/webhooks/{webhook.id}/{webhook.token}', data={'content':message})

sending direct messages from nodejs script to telegram

Is it possible to send a message from a node.js server to someone's mobile number or telegram Id directly?
is it possible without using a telegram bot?
I need an API like below:
function sendMessage(senderTelegramId, receiverTelegramId, messageText)
In short: No, without a bot no way for now.
Detailed explanation:
In order for you to send users messages on telegram you would need to create your own telegram bot. They have a well documented API which you can read and play around with.
There are 2 things you should know about sending messages to users using telegram bot:
You can't just send random people messages on telegram even if you know their phone number, to send them messages you need to have their chat_id. See how in the docs
To get the chat_id the user must first click the start button that comes up when they open your bot for the first time. Telegram will send you the chat id of that user and you save it for later when you would want to send messages to that user.
There are tons of libraries that makes working telegram bots very easy, it wouldn't take you more than an hour to get started.
I hope this answers the question, feel free to ask further questions, I have made some bots and you can also play around with them to see how it works.
Cheers )
There is actually one more easiest way to send a message to chat
just fetch the URL
https://api.telegram.org/bot[BOT_API_KEY]/sendMessage?chat_id=[MY_CHANNEL_NAME]&text=[MY_MESSAGE_TEXT]
you can find more details here
https://xabaras.medium.com/sending-a-message-to-a-telegram-channel-the-easy-way-eb0a0b32968

How to read a message from a bot via telegram API?

I have a room with a couple of bots, one of them needs to read all the messages on the room including other bot's messages.
Telegram API says bots can't see other bots message otherwise they might get caught in a "loop".
Since i really need to work around this i'm wondering if there is a known workaround?
There cannot be any workaround using the Bot APIs since the messages in getUpdates or webhook of the Bot will be from Users alone.
One workaround could be to use the telegram-cli and create a normal user as a Bot.

Is it possible for a Telegram Bot to send any type of message without users trigger?

So I need my Telegram bot to ask a question from user (send any message of any possible type) without any initiation from a user. Is it possible? I cant find anything about this.
If the user interacted with your bot before you just need to use their user_id and send your message. You can't however send message to a user who has never interacted with your bot.
Telegram BOT never can take an action before user interact with bot. because most of available method need "chat_id". if you dont have "chat_id", you can only run simple method like getMe, getUpdates,etc.

Resources