Made the bot more generic now
This commit is contained in:
parent
c63efe5e67
commit
ad27a25d1f
8 changed files with 24 additions and 15 deletions
|
@ -31,7 +31,9 @@ module.exports = (bot) => {
|
|||
|
||||
bot.command("about", spamwatchMiddleware, async (ctx) => {
|
||||
const Strings = getStrings(ctx.from.language_code);
|
||||
ctx.reply(Strings.botAbout, {
|
||||
const aboutMsg = Strings.botAbout.replace("{sourceLink}", `${process.env.botSource}`);
|
||||
|
||||
ctx.reply(aboutMsg, {
|
||||
parse_mode: 'Markdown',
|
||||
disable_web_page_preview: true,
|
||||
reply_to_message_id: ctx.message.message_id
|
||||
|
|
|
@ -90,6 +90,7 @@ module.exports = (bot) => {
|
|||
const Strings = getStrings(ctx.from.language_code);
|
||||
const lastfmUser = users[userId];
|
||||
const genericImg = "https://lastfm.freetls.fastly.net/i/u/300x300/2a96cbd8b46e442fc41c2b86b821562f.png";
|
||||
const botInfo = await ctx.telegram.getMe();
|
||||
|
||||
if (!lastfmUser) {
|
||||
return ctx.reply(Strings.lastFmNoSet, {
|
||||
|
@ -109,7 +110,7 @@ module.exports = (bot) => {
|
|||
limit: 1
|
||||
},
|
||||
headers: {
|
||||
'User-Agent': "kowalski-@KowalskiNodeBot-node-telegram-bot"
|
||||
'User-Agent': `@${botInfo.username}-node-telegram-bot`
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -159,7 +160,7 @@ module.exports = (bot) => {
|
|||
format: 'json',
|
||||
},
|
||||
headers: {
|
||||
'User-Agent': "kowalski-@KowalskiNodeBot-node-telegram-bot"
|
||||
'User-Agent': `@${botInfo.username}-node-telegram-bot`
|
||||
}
|
||||
});
|
||||
num_plays = response_plays.data.track.userplaycount;
|
||||
|
|
|
@ -5,7 +5,10 @@ const spamwatchMiddleware = require('../plugins/lib-spamwatch/Middleware.js')(is
|
|||
module.exports = (bot) => {
|
||||
bot.start(spamwatchMiddleware, async (ctx) => {
|
||||
const Strings = getStrings(ctx.from.language_code);
|
||||
ctx.reply(Strings.botWelcome, {
|
||||
const botInfo = await ctx.telegram.getMe();
|
||||
const startMsg = Strings.botWelcome.replace('{botName}', botInfo.first_name);
|
||||
|
||||
ctx.reply(startMsg, {
|
||||
parse_mode: 'Markdown',
|
||||
reply_to_message_id: ctx.message.message_id
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue