
Product
Secure Your AI-Generated Code with Socket MCP
Socket MCP brings real-time security checks to AI-generated code, helping developers catch risky dependencies before they enter the codebase.
botfather
Advanced tools
Name | Description |
---|---|
RadioArchiveBot | Listen your favorite radio stations right in the Telegram! |
EPGBot | Electronic program guides (TV guides) |
Want to add your bot? Please submit a pull request on GitHub to update this page!
$ cd MyBot
$ npm install botfather --save
// We recommend storing the token as environment variable.
const TOKEN = process.env.TOKEN
const BotFather = require('botfather')
const bf = new BotFather(TOKEN)
bf.api('getMe')
.then(json => {
if(json.ok) {
return json.result
}
console.error(json.description)
})
.then(bot => {
console.info(`Your bot is @${bot.username}, right? :)`)
})
.catch(exception => {
console.error(exception.stack)
})
const fs = require("fs");
// ...
bf.api("sendDocument", {
chat_id: CHAT_ID,
document: fs.createReadStream(PATH_TO_FILE)
})
.then(json => {
if(json.ok) {
return json.result
}
console.error(json.description)
})
.then(result => {
console.info(result)
})
.catch(exception => {
console.error(exception.stack)
})
class MyBot extends BotFather {
/**
* @param {string} token
* @see https://core.telegram.org/bots#6-botfather
*/
constructor(token) {
super(token)
this.api('getMe')
.then(json => {
if(json.ok) {
return json.result
}
console.error(json.description)
})
.then(bot => {
console.info(`Your bot is @${bot.username}, right? :)`)
})
.catch(exception => {
console.error(exception.stack)
})
}
}
new MyBot(TOKEN)
class MyBot extends BotFather {
/**
* @constructor
* @param {string} token
* @see https://core.telegram.org/bots#6-botfather
*/
constructor(token) {
super(token)
this.getUpdates()
}
/**
* @param {Object} parameters
* @see https://core.telegram.org/bots/api#getupdates
*/
getUpdates(parameters = {limit: 100, timeout: 60 * 2}) {
this.api('getUpdates', parameters)
.then(json => {
if(json.ok) {
return json.result
}
console.error(json.description)
setTimeout(() => this.getUpdates(parameters), 5000)
})
.then(updates => {
for(let update of updates) {
this.onReceiveUpdate(update)
}
// offset = update_id of last processed update + 1
if(updates.length > 0) {
const identifiers = updates.map((update) => update.update_id)
parameters.offset = Math.max.apply(Math, identifiers) + 1
}
this.getUpdates(parameters)
})
.catch(exception => {
console.error(exception.stack)
setTimeout(() => this.getUpdates(parameters), 5000)
})
}
/**
* @param {Object} update
* @see https://core.telegram.org/bots/api#update
*/
onReceiveUpdate(update) {
console.log(update)
}
}
new MyBot(TOKEN)
FAQs
Lightweight node.js module for easier use telegram bot platform.
The npm package botfather receives a total of 142 weekly downloads. As such, botfather popularity was classified as not popular.
We found that botfather demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Socket MCP brings real-time security checks to AI-generated code, helping developers catch risky dependencies before they enter the codebase.
Security News
As vulnerability data bottlenecks grow, the federal government is formally investigating NIST’s handling of the National Vulnerability Database.
Research
Security News
Socket’s Threat Research Team has uncovered 60 npm packages using post-install scripts to silently exfiltrate hostnames, IP addresses, DNS servers, and user directories to a Discord-controlled endpoint.