Skip to content
This repository was archived by the owner on Aug 10, 2022. It is now read-only.
This repository was archived by the owner on Aug 10, 2022. It is now read-only.

TypeError: Cannot read property 'winstonColors' of undefined #134

@Dimcenco

Description

@Dimcenco

Every time I try to run this sample of code:

var ChatBot = require('steam-chat-bot').ChatBot;

// This will log in a steam user with the specified username and password
// You can also pass in a steam guard code from an email
var myBot = new ChatBot('-----------', '------------');

// Set up the triggers to control the bot
myBot.addTriggers([

	// Commands to stop/unstop the bot from saying anything in a chatroom
	{
		name: 'MuteCommand',
		type: 'BotCommandTrigger',
		options: {
			matches: ['!mute', '!pause'],
			exact: true,
			callback: function(bot) { bot.mute(); }
		}
	},
	{
		name: 'UnmuteCommand',
		type: 'BotCommandTrigger',
		options: {
			matches: ['!unmute', '!unpause'],
			exact: true,
			callback: function(bot) { bot.unmute(); }
		}
	},

	// Automatically accept invites from any user to the specified group chat
	{
		name: 'AcceptChatInvite',
		type: 'AcceptChatInviteTrigger',
		options: {
			chatrooms: { 'GroupSteamId': 'Welcome message' },
			autoJoinAfterDisconnect: true
		}
	},

	// Automatically accept all friend requests
	{ name: 'AcceptFriendRequest', type: 'AcceptFriendRequestTrigger' },

	// Reply triggers - respond to a chat/private message if it matches a set of inputs
	// (case-insensitive exact or substring match), and choose randomly from a set of responses
	{
		name: 'EmptyQuoteReply',
		type: 'ChatReplyTrigger',
		options: {
			matches: ['^'],
			responses: ['^'],
			exact: true,
			delay: 1000,
			probability: 0.2,
			timeout: 10*1000
		}
	},
	{
		name: 'HeartReply',
		type: 'ChatReplyTrigger',
		options: {
			matches: ['<3'],
			responses: ['</3', '<3'],
			exact: true,
			delay: 500,
			probability: 0.5,
			timeout: 60*60*1000 } },
]);

myBot.connect();

// Trigger details can be retrieved and reloaded so that external configuration can be supported
var details = myBot.getTriggerDetails();
myBot.clearTriggers();
myBot.addTriggers(details);

It will give me this error:

PS C:\Users\Dima\Desktop> node proj2.js
warn: Init: No servers file found, using defaults
C:\Users\Dima\node_modules\steam-chat-bot\lib\chatBot.js:74
                colors: options.winstonColors||wcfg.colors
                               ^

TypeError: Cannot read property 'winstonColors' of undefined
    at new ChatBot (C:\Users\Dima\node_modules\steam-chat-bot\lib\chatBot.js:74:18)
    at Object.<anonymous> (C:\Users\Dima\Desktop\proj2.js:5:13)
    at Module._compile (module.js:570:32)
    at Object.Module._extensions..js (module.js:579:10)
    at Module.load (module.js:487:32)
    at tryModuleLoad (module.js:446:12)
    at Function.Module._load (module.js:438:3)
    at Module.runMain (module.js:604:10)
    at run (bootstrap_node.js:390:7)
    at startup (bootstrap_node.js:150:9)
PS C:\Users\Dima\Desktop>

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions