Skip to content
This repository has been archived by the owner on Feb 2, 2021. It is now read-only.

Update channel topic when Test Day starts and ends #34

Closed
wants to merge 6 commits into from

Conversation

galgeek
Copy link
Contributor

@galgeek galgeek commented Dec 24, 2014

hi @whimboo !

with apologies for the untidy commit list, suspecting this requires re-forking the repo to fix, and not sure what that would do to existing pull requests. This will fix issue #31.

@@ -16,6 +16,9 @@ var ircServer = config.server,
helpers = config.helpers,
startTime = Date.now(),
endTime = startTime,
topic = "",
qaTopic = "",
qaChannel = config.channels[0],
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The bot should update the topic in each of the channels, it has joined. So we don't need a special casing here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need a variable to save the pre-Test Day topic, to restore it after the Test Day.

I have been thinking that the bot runs only in #qa (fennecbot appears to run only in #mobile, though it advertises to several other channels). Is that not correct?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's correct. The simplest solution would be to change config.channels to a single channel. If needed we could expand it to an array later.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You may also want to name the variable which holds the former topic as topic_backup or similar but not with a channel name included.

@galgeek galgeek changed the title issue 31: update channel topic (#31) Update channel topic when Test Day starts and ends Dec 30, 2014
galgeek added a commit to galgeek/testdaybot that referenced this pull request Dec 30, 2014
@galgeek
Copy link
Contributor Author

galgeek commented Dec 30, 2014

hi @whimboo !

thanks for your feedback. I've tidied up the commits, but I haven't made any other changes: I have been thinking that the bot runs in qa, though it also advertises in other channels. fennecbot similarly runs in mobile while it advertises in several other channels. Should this bot be different?

@galgeek
Copy link
Contributor Author

galgeek commented Dec 31, 2014

hi @whimboo !
thanks for your feedback. I've updated variable names.
config.channels gets used to configure the client, which expects an array, so we can't easily make this simpler.

@@ -10,12 +10,15 @@ var ircServer = config.server,
autoRejoin: config.autoRejoin,
},
client = new irc.Client(ircServer, nick, options),
botChannel = config.channels[0],
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just name it channel. It won't be anything else than the bot. :)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

node irc uses channel throughout its documentation for function parameters, so it's a little confusing for anyone who's looking at that documentation to use channel as a separate variable name. I've made the change. I wonder what you'd prefer for the node irc function parameters, which I'm calling channl for now.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

By default we use an a prefix for function parameters across all of our repositories. It would be good to refactor the code appropriate, but lets move this out to another issue. This could even be a good first mentored bug for someone. Lets skip that for now.

@whimboo
Copy link
Contributor

whimboo commented Jan 5, 2015

Also I think at the moment the bot waits for an activity in the channel before it updates the topic of the channel when the testday is about to start. Shouldn't this be handled with a timer event or such?

@galgeek
Copy link
Contributor Author

galgeek commented Jan 6, 2015

hi @whimboo

a biggish update, now using setTimeout to start and end test day, and other updates per your recent feedback

thank you!

}
}

client.addListener('join', function(channel, who){
checkTestDay();
client.addListener('topic', function (channl, channlTopic, nick) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please revert this change to the parameter names. Stripping of chars should never be an option.

@galgeek
Copy link
Contributor Author

galgeek commented Jan 6, 2015

Hi @whimboo

I've updated per your comments, including adding issue #43 save and reload test day schedule across bot restarts.

Note that current code accepts the :next admin command only when a test day is not in progress, so I've made no changes to clearTimeout there.

@galgeek
Copy link
Contributor Author

galgeek commented Jan 8, 2015

Hi @whimboo!

I've rebased and added test and qa config files.

I've left this version of the bot running using the test config, with a test Test Day scheduled for 6A-10A UTC. I'll check that it starts before I go to sleep, and maybe you'll have a chance to check that it's still running fine in the morning CET.

Thank you!

"autoRejoin": "true",
"admins": ["ashughes","whimboo","galgeek","bara"],
"helpers": ["ashughes","whimboo","bara"]
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove that file from the patch. It's nice for testing but does not belong to the repository.

@galgeek
Copy link
Contributor Author

galgeek commented Jan 8, 2015

Hi @whimboo!

I've removed the testing configs from the repo and updated .gitignore, and I've updated the PR.

I'm leaving any additional changes to updateTestDayData for later.

Thank you!

@@ -1,3 +1,4 @@
*.swp
.DS_Store

config.json.test
config.json.qa
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Those are your own personal files on your machine. This is not for general use. So please remove.

@galgeek
Copy link
Contributor Author

galgeek commented Jan 8, 2015

Hi, @whimboo!

As we noted in IRC, I've updated this PR, backing out the .gitignore edits.

Thank you!

Barbara

@whimboo
Copy link
Contributor

whimboo commented Jan 9, 2015

This PR needs to be updated due to merge conflicts.

@galgeek
Copy link
Contributor Author

galgeek commented Jan 9, 2015

Hi @whimboo!

I've updated.

Thank you again for all your help!

@whimboo
Copy link
Contributor

whimboo commented Jan 12, 2015

This looks good to me. I rebased the commits and merged the branch as e38ec3a.

@whimboo whimboo closed this Jan 12, 2015
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants