| 
									
										
										
										
											2025-07-30 09:51:32 +01:00
										 |  |  | const utils = require('./utils'); | 
					
						
							| 
									
										
										
										
											2021-07-12 13:33:59 +00:00
										 |  |  | const Nato = require('nato'); | 
					
						
							| 
									
										
										
										
											2020-06-30 16:25:55 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | module.exports = { | 
					
						
							|  |  |  |     whatSubShouldIBuy: (bot, msg, logger) => { | 
					
						
							| 
									
										
										
										
											2025-07-30 09:51:32 +01:00
										 |  |  |         let subs = utils.loadSubs(); | 
					
						
							| 
									
										
										
										
											2020-06-30 16:25:55 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  |         const whatSubShouldIBuy = "what sub should i buy" | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         if (msg.text && msg.text.toString().toLowerCase().includes(whatSubShouldIBuy)) { | 
					
						
							|  |  |  |             logger.info("ID - " + msg.from.id + " First Name - " + msg.from.first_name + " Asked what sub to buy"); | 
					
						
							|  |  |  |             const randomSub = subs[Math.floor(Math.random() * subs.length)]; | 
					
						
							|  |  |  |             bot.sendMessage(msg.chat.id, randomSub.SUB + "!"); | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  |     }, | 
					
						
							| 
									
										
										
										
											2025-07-05 16:57:26 +01:00
										 |  |  |     subStatus: async (bot, msg, logger, notify = false, chatId = null) => { | 
					
						
							| 
									
										
										
										
											2025-07-30 09:51:32 +01:00
										 |  |  |         let subs = utils.loadSubs(); | 
					
						
							| 
									
										
										
										
											2020-06-30 16:25:55 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  |         let string = "" | 
					
						
							|  |  |  |         const subStatus = "sub status"; | 
					
						
							| 
									
										
										
										
											2021-07-12 13:33:59 +00:00
										 |  |  |         logger.info("ID - " + msg.from.id + " First Name - " + msg.from.first_name + " Asked how to get a subscription"); | 
					
						
							|  |  |  |         subs.forEach(element => { | 
					
						
							|  |  |  |             if (element.STATUS != "X") { | 
					
						
							|  |  |  |                 if (element.STATUS === 1) { | 
					
						
							|  |  |  |                     element.STATUS = "Up" | 
					
						
							|  |  |  |                 } else { | 
					
						
							|  |  |  |                     element.STATUS = "Down" | 
					
						
							| 
									
										
										
										
											2020-06-30 16:25:55 +00:00
										 |  |  |                 } | 
					
						
							| 
									
										
										
										
											2021-07-12 13:33:59 +00:00
										 |  |  |                 let catString = element.SUB + " Is " + element.STATUS | 
					
						
							|  |  |  |                 // console.log(catString)
 | 
					
						
							|  |  |  |                 string += '\n' + catString; | 
					
						
							|  |  |  |             } | 
					
						
							|  |  |  |         }); | 
					
						
							|  |  |  |         // console.log(string)
 | 
					
						
							| 
									
										
										
										
											2025-07-05 16:57:26 +01:00
										 |  |  |         const targetChatId = chatId || msg.chat.id; | 
					
						
							|  |  |  |         data = await bot.sendMessage(targetChatId, string, { parse_mode: "HTML", disable_notification: notify }) | 
					
						
							| 
									
										
										
										
											2023-12-05 13:39:29 +00:00
										 |  |  |         if (notify == true) { | 
					
						
							| 
									
										
										
										
											2025-07-05 16:57:26 +01:00
										 |  |  |             bot.pinChatMessage(targetChatId, data.message_id) | 
					
						
							| 
									
										
										
										
											2023-12-05 13:39:29 +00:00
										 |  |  |         } | 
					
						
							|  |  |  |     }, | 
					
						
							|  |  |  |     updates_page: async (bot, msg, logger) => { | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         bot.sendMessage(msg.chat.id, `<a href='https://t.me/+Xr3cFsqJAVYwNTNk'>Bob15TV Updates page</a>`, { parse_mode: "HTML" }) | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-07-12 13:33:59 +00:00
										 |  |  |     }, | 
					
						
							|  |  |  |     password: (bot, msg, match, logger) => { | 
					
						
							|  |  |  |         logger.info("ID - " + msg.from.id + " First Name - " + msg.from.first_name + " Asked for their password being spelt"); | 
					
						
							|  |  |  |         // console.log(string)
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         let sendString = new Nato(match.toLowerCase()) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         bot.sendMessage(msg.chat.id, sendString.nato, { | 
					
						
							|  |  |  |             force_reply: true, | 
					
						
							|  |  |  |             parse_mode: "HTML" | 
					
						
							|  |  |  |         }) | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | } |