raw 311:*: { set %user.host.tmp $4 } on *:connect: { ; Point to Database Path set %botdb $sqlite_open($scriptdirDatabases\xfed.db) ; If the database exists, skip the check. if ($exists($scriptdirDatabases\xfed.db)) { noop $tip(Information,Information,Database Exists -- Loading Bot...) start } else { noop $tip(Information,Information,Database not created -- Running Configuration.) dbsetup } } alias start { ; Grab owner information var %sql = SELECT Owner, IPAddress FROM Bot var %request = $sqlite_query(%botdb, %sql) if (%request && $sqlite_fetch_row(%request, row)) { ; Grab 'Owner' (1) Field from the table 'Bot' and apply it to an global variable. ; Grab 'IP Address' (2) Field from the table 'Bot' and apply it to an global variable. set %xfed.owner $hget(row, 1) set %xfed.ip $hget(row, 2) sqlite_free %request noop $tip(Information,Information,Welcome back %xfed.owner $+ ) } else { noop $tip(Error,Error,Error executing query... Error %sqlite_errno -- %sqlite_errstr $+ ) halt } } alias dbsetup { ; Do query here for correct DNS lookup.. set %bot.server $?="What server will the bot run on?" set %bot.owner $?="Enter the nickname of who will be administrating this bot:" set %bot.channel $?="Where will this bot run in?" set %bot.nick $?="What will my nick be?" whois %bot.owner ; Create 'Bot' table and fill in the fields sqlite_exec %botdb CREATE TABLE IF NOT EXISTS Bot (ID INTEGER PRIMARY KEY AUTOINCREMENT, Owner UNIQUE, IPMask, BServer, BChannel, BNick) set -l %sql INSERT INTO Bot (Owner, IPMask, BServer, BChannel, BNick) VALUES ( $sqlite_qt(%bot.owner) , $sqlite_qt(%user.host.tmp) , $sqlite_qt(%bot.server) , $sqlite_qt(%bot.channel) , $sqlite_qt(%bot.nick) ) echo -a SQL: %sql if ($sqlite_exec(%botdb, %sql)) { noop $tip(Information,Information,Query Successful $+ ) } else { noop $tip(Error,Error,$scriptline $+ : Error %sqlite_errno -- %sqlite_errstr $+ ) } unset %bot.dns }