mirror of https://github.com/bonobonet/botty
Compare commits
2 Commits
08fe9b643f
...
2e94ecef69
Author | SHA1 | Date |
---|---|---|
Tristan B. Velloza Kildaire | 2e94ecef69 | |
Tristan B. Velloza Kildaire | dd253b6292 |
|
@ -2,5 +2,5 @@
|
|||
"serverAddr": "rany.irc.bnet.eu.org",
|
||||
"serverPort": 6667,
|
||||
"nickname": "bottyng",
|
||||
"channels": "#bot,#tlang"
|
||||
"channels": ["#bot", "#tlang"]
|
||||
}
|
||||
|
|
2
dub.json
2
dub.json
|
@ -6,7 +6,7 @@
|
|||
"dependencies": {
|
||||
"birchwood": ">=2.0.1-beta.1",
|
||||
"eskomcalendar4d": ">=0.1.3",
|
||||
"jstruct": ">=0.1.3",
|
||||
"jstruct": ">=0.2.11",
|
||||
"lumars": ">=1.11.0"
|
||||
},
|
||||
"description": "IRC bot for the BonoboNET IRC network",
|
||||
|
|
|
@ -37,11 +37,9 @@ void main(string[] args)
|
|||
|
||||
// // Set the fakelag to 1 second
|
||||
// connInfo.setFakeLag(1);
|
||||
|
||||
// Extract the channels to connect to
|
||||
string[] channels = split(config.channels, ",");
|
||||
|
||||
Bot botty = new Bot(connInfo, channels);
|
||||
|
||||
Bot botty = new Bot(connInfo, config);
|
||||
|
||||
// Start the bot
|
||||
botty.start();
|
||||
|
|
|
@ -5,17 +5,17 @@ import lumars;
|
|||
import std.conv : to;
|
||||
import core.thread : Thread, dur;
|
||||
import botty.mod : Mod;
|
||||
|
||||
import botty.config : Config;
|
||||
public class Bot : Client
|
||||
{
|
||||
private string[] channels;
|
||||
private Config config;
|
||||
|
||||
private Mod[] modules;
|
||||
|
||||
this(ConnectionInfo info, string[] channels)
|
||||
this(ConnectionInfo info, Config config)
|
||||
{
|
||||
super(info);
|
||||
this.channels = channels;
|
||||
this.config = config;
|
||||
|
||||
// TODO: testing addTestModules
|
||||
addTestModules();
|
||||
|
@ -51,7 +51,7 @@ public class Bot : Client
|
|||
Thread.sleep(dur!("seconds")(2));
|
||||
|
||||
// Join channels requested
|
||||
joinChannel(channels);
|
||||
joinChannel(config.channels);
|
||||
}
|
||||
|
||||
public override void onChannelMessage(Message fullMessage, string channel, string msgBody)
|
||||
|
|
|
@ -21,9 +21,9 @@ public struct Config
|
|||
string nickname;
|
||||
|
||||
/**
|
||||
* Channels to join (in CSV format (for now))
|
||||
* Channels to join
|
||||
*/
|
||||
string channels;
|
||||
string[] channels;
|
||||
}
|
||||
|
||||
public Config getConfig(string configPath)
|
||||
|
|
Loading…
Reference in New Issue