Skip to content

Commit

Permalink
update-bot
Browse files Browse the repository at this point in the history
  • Loading branch information
Liam Faruq authored and Liam Faruq committed Oct 29, 2023
1 parent 930709e commit 41d5157
Showing 1 changed file with 23 additions and 3 deletions.
26 changes: 23 additions & 3 deletions telegram-service/src/bot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {queryDatabaseByUserId} from './WalletStore';

dotenv.config();

const { PORT, TELEGRAM_TOKEN, SERVER_URL } = process.env;
const { PORT, TELEGRAM_TOKEN, SERVER_URL, MAINET_EXPLORER_URL } = process.env;


const app = express();
Expand Down Expand Up @@ -255,7 +255,7 @@ type MessageInfo = {
console.log(`Successfully transferred ${balance.toString()} tokens to ${personalWallet} for user ${telegramUsername}. Transaction Hash: ${result.hash}`);


return `https://coston2-explorer.flare.network/tx/${result.hash}`;
return `${MAINET_EXPLORER_URL}${result.hash}`;
} catch (error) {
console.error(`ERROR: Failed to redeem tokens for user ${telegramUsername}. Details: ${error.message}`);
}
Expand All @@ -281,7 +281,7 @@ type MessageInfo = {

console.log(tx);

const transactionReceiptURL = `https://coston2-explorer.flare.network/tx/${tx.hash}`;
const transactionReceiptURL = `${MAINET_EXPLORER_URL}${tx.hash}`;

return [address, wallet.privateKey,transactionReceiptURL];
}
Expand Down Expand Up @@ -399,6 +399,26 @@ app.post(URI, async (req: Request, res: Response) => {
console.log("=========UPDATES==========")
}

if(sentMessage === '/start'){
const welcomeMsg = `Welcome Chat Champion! πŸŒŸπŸš€πŸŽ‰
Welcome to Chat Champions, an engaging Telegram community where you can earn tokens by chatting, engaging with communities, and sharing your humor through jokes. Join us, climb the leaderboard for rewards, participate in fun challenges, and reach out to our Chatbot Champions for assistance. Don't forget to create your wallet by messaging our admins to enhance your Chat Champions experience! πŸŒŸπŸ’¬πŸš€πŸŽ‰
Why be a Chat Champion?
- Earn tokens by chatting and engaging with communities. πŸ’¬πŸ’°
- Share humor and make jokes to add positivity. πŸ˜‚πŸ˜
- Climb the leaderboard for exciting rewards. πŸ†πŸŽ
- Participate in regular challenges and special events. πŸŒˆπŸŽ‰
- Chatbot Champions are ready to assist you. πŸ€–πŸ’Ό
- Create your wallet for an enhanced experience. πŸ’Όβœ¨
- To redeem your tokens, type /redeem <address>πŸ’°
Join now and DM our admins to get EXCLUSIVE ACCESS and WIN CHAMP Tokens!πŸ’¬πŸ†`;

await sendMessage(chatId,welcomeMsg);

}

// Send the response after the asynchronous operation is complete
res.status(200).send('ok');
} catch (error) {
Expand Down

0 comments on commit 41d5157

Please sign in to comment.