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

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

Open
Dimcenco opened this issue May 19, 2017 · 1 comment
Open

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

Dimcenco opened this issue May 19, 2017 · 1 comment

Comments

@Dimcenco
Copy link

Dimcenco commented May 19, 2017

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>
@Efreak
Copy link
Member

Efreak commented Jun 15, 2017

I'll take a look at it soon™️.

Also, remove the following lines, as they're entirely unnecessary for general use:

var details = myBot.getTriggerDetails();
myBot.clearTriggers();
myBot.addTriggers(details);

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants