← back to browse
goat event

startup

No description

0
views
0
likes
0
installs
raw source
module.exports = {
	config: {
		name: "startup",
		version: "1.0",
		author: "Israfil",
		countDown: 0,
		role: 0,
		description: {
			en: "Bot startup announcement - runs automatically when bot starts"
		},
		category: "system",
		guide: {
			en: "Runs automatically - no command needed"
		}
	},

	onLoad: async function ({ api, threadsData }) {
		try {
			// Get all groups/threads where bot is active
			const allThreads = await threadsData.getAll();
			
			const startupMessage = `
๐Ÿค– BOT IS ONLINE! ๐Ÿค–

โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”
โœ… Status: ACTIVE
โšก Power: 100%
๐Ÿ”ง All systems: OPERATIONAL
๐Ÿ’ซ Ready to serve you!

โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”

๐ŸŽŠ Welcome! The bot is now running
Type .help to see all commands
		`;

			// Send startup message to all groups
			if (allThreads && allThreads.length > 0) {
				for (const thread of allThreads) {
					try {
						await api.sendMessage(startupMessage, thread.threadID);
						// Small delay to avoid rate limiting
						await new Promise(resolve => setTimeout(resolve, 500));
					} catch (err) {
						console.error(`Failed to send startup message to thread ${thread.threadID}:`, err.message);
					}
				}
			}

			console.log("โœ… Bot startup announcement sent to all groups!");

		} catch (err) {
			console.error("Startup command error:", err.message);
		}
	}
};

View raw file