运行 BadGirl

获取 BadGirl

创建 BadGirl 数据库

BadGirl 可使用 MySQL 或者 PostgreSQL 或者 SQLite。

MySQL

创建一个新的 MySQL 数据库,库名为 BadGirl,用户名为 username,密码为 password,过程不再详述

MySQL 初始化库表和数据
$ mysql -u username -ppassword -D BadGirl < table-skel.mysql.sql
$ mysql -u username -ppassword -D BadGirl < data.sql

PostgreSQL

待续

SQLite

SQLiteL 初始化库表和数据
$ sqlite3 badgirl.db < table-skel.sqlite3.sql
$ sqlite3 badgirl.db < data.sqlite3.sql

配置 moobot.conf

编辑配置
(复制 moobot.conf.example 为 mootbot.conf)
$ cp moobot.conf.example moobot.conf
(编辑 mootbot.conf)
$ vim moobot.conf
mootbot.conf
[config]
; 本配置文件的编码
encoding = UTF-8

[connection]
; IRC 链接配置
nick = BadGirl
username = BadGirl
realname = BadGirl 
; 服务器地址
server =  localhost
; 服务器端口
port = 6667
; 连接或者 NickServ 密码
password = <password>

; 自动进入的频道
; 需要密码的房间使用 #channel:passwd 格式, 多个房间之间用逗号分隔, 不能空格
channels = #linuxfire
; 连接交换码(外码)
encoding = GB18030

[botconfig]
; 机器人命令触发前缀,带有"~"前缀的消息才被机器人理解为命令
shorthand = ~
owner=None

[database]
; 数据库连接配置
; 数据库用户名
username = <username>
; 数据库主机名, 对于 mysql 来说 localhost 跟 127.0.0.1 是不一样的, 注意授权
hostname = localhost
; 数据库名字
name = <databasename>
; 数据库密码
password = <password>
; 数据库端口号
port = 3306
encoding = utf8

[ohloh]
; ohloh 命令用的服务 key, 从 ohloh.net 申请
key=

[modules]
; 机器人运行后自动加载的模块
modulefiles = internal eventProcess quotegrab flood_protect botmath bottime ims ....

指定数据库类型

进入 src 目录,新建一个名为 database.py 的符号链接,指向你所使用的数据库。 例如使用 MySQL,则符号链接指向 database.MySQLdb.py。使用 PostgreSQL 则将链接指向 database.pgsql.py

指定数据库接口
(如果你用 MySQL)
$ ln -sf database.MySQLdb.py database.py

(如果你用 SQLite3)
$ ln -sf database.sqlite3.py database.py

(如果你用 PostgreSQL)
$ ln -sf database.pgsql.py database.py

执行 BadGirl

启动
$ ./src/moobot.py moobot.conf