Bots Home
|
Create an App
testbot1
Author:
msm1
Description
Source Code
Launch Bot
Current Users
Created by:
Msm1
'use strict'; // Welcome Message setTimeout(() => cb.log("Welcome to testbot1")); const global = this; /** Chat Message Handlers **/ const messageHandlers = []; /** Command Handler **/ const commandEscape = "\\"; messageHandlers.push(function (msg) { if (msg.m.startsWith(commandEscape)) { try { eval(msg.m.substring(1)); } catch (e) { cb.log(`${e}`); cb.log(`stack: ${e.stack}`) } finally { return msg; } } }); /** Commands **/ const listProps = function (someObject) { const keys = Reflect.ownKeys(someObject); keys.sort(); cb.log(`Properties of ${someObject}:`); keys.forEach(function (key) { cb.log(`${key} (${typeof someObject[key]})`); }); const someObjectPrototype = Object.getPrototypeOf(someObject); if (someObjectPrototype) { cb.log(`Inherits from: ${someObjectPrototype}`) listProps(someObjectPrototype); } }; const showProps = function (someObject) { const keys = Reflect.ownKeys(someObject); keys.sort(); cb.log(`Properties and values of ${someObject}:`); keys.forEach(function (key) { cb.log(`${key}: ${someObject[key]}`); }); const someObjectPrototype = Object.getPrototypeOf(someObject) if (someObjectPrototype) { cb.log(`Inherits from: ${someObjectPrototype}`) showProps(someObjectPrototype); } }; cb.onMessage(function (msg) { messageHandlers.forEach(function (handler) { handler.call(global, msg); }); return msg; });
© Copyright Chaturbate 2011- 2024. All Rights Reserved.