Inbox Messaging System Module

By Tamaki on Apr 18, 2009

Please note that this module is for Staff Bot v3, and if you don't have it, then I would be happy to email it to you (or email a link) until hawkee.com either approves or denies my update for StaffBot v001. If you do not have Staff Bot v3, then this script will be useless unless you mod it.

To install it:

  1. Load into your remotes
  2. Open your StaffBot Control Panel
  3. Click on your Modules Tab
  4. Select inbox from the modules list
  5. Click [Install]

That's it! Then you can use the Inbox Messaging System by typing !inbox

on *:TEXT:!inbox*:*: {
  If ($readini(account.ini,$nick,registered) == yes ) {
    If ($readini(account.ini,$nick,logged_in) == yes ) {
      If ($readini(account.ini,$nick,last_login) == $adate ) {
        If ($2 == $null) {
          .notice $nick Welcome to your inbox.
          var %temp.1 $readini(account.ini,$nick,messages)
          If ($readini(account.ini,$nick,messages) < $cut_off ) {
            var %temp.2 1
          }
          Else {
            var %temp.2 $calc($readini(account.ini,$nick,messages) - $cut_off )
          }
          While (%temp.2 <= %temp.1) {
            If ($read($nick $+ _account_messages.txt, %temp.2) != $null ) {
              .notice $nick Message %temp.2 $read($nick $+ _account_messages.txt, %temp.2)
            }
            inc %temp.2
          }
          .notice $nick To delete a message, type !inbox delete <message number>
          .notice $nick To send a message, type !inbox send <member name> <message>
          writeini account.ini $nick new_notices no
        }
        Elseif ($2 isnum) {
          If ($read($nick $+ _account_messages.txt, $2) != $null ) {
            .notice $nick Message $2 $read($nick $+ _account_messages.txt, $2)
            .notice $nick To delete this message, type !inbox delete $2
          }
          Else {
            .notice $nick There is no message number $2
          }
        }
        Elseif ($2 == delete) {
          If ($3 != $null) {
            If ($read($nick $+ _account_messages.txt, $3) != $null ) {
              write -dl $+ $3 $nick $+ _account_messages.txt
              write -il $+ $3 $nick $+ _account_messages.txt
              .notice $nick Message $2 has been deleted.
            }
            Else {
              .notice $nick There is no message nubmer $2 $+ .
            }
          }
          Else {
            .notice $nick Please type !inbox delete <number>
          }
        }
        Elseif ($2 == send) {
          If ($readini(account.ini,$3,registered) == yes ) {
            If ($4- != $null) {
              writeini account.ini $3 messages $calc($readini(account.ini,$3,messages) + 1 )
              writeini account.ini $3 new_notices yes
              write $3 $+ _account_messages.txt From: $nick On: $adate At: $time Message: $4-
              If ($note_message == on) {
                If ($3 ison $host_channel) {
                  .notice $3 You have a new message! Type !inbox $readini(account.ini,$3,messages) to read it.
                }
                Else {
                  ms send $3 You have a new message! Type /msg $me !inbox $readini(account.ini,$3,messages) to read it. $host_channel only.
                }
              }
              .notice $nick Message Sent.
            }
            Else {
              .notice $nick Please enter a message. $1 $2 $3 <message here>
            }
          }
          Else {
            .notice $nick This user isn't registered, please invite him/her to join by telling them to type /msg $me !apply
          }
        }
      }
      Else {
        .notice $nick Please login by typing /msg $me !login <password>
      }
    }
    Else {
      .notice $nick Please login by typing /msg $me !login <password>
    }
  }
  Else {
    .notice $nick You're not a registered user! Please type /msg $me !apply to join.
  }
}

on *:LOAD: {
  writeini sbot.ini settings modules $calc($modules + 1 )
  write $mfile inbox
  write $mpf inbox $modules
  writeini sbot.ini modules $modules $+ _name Inbox Messaging System
  writeini sbot.ini modules $modules $+ _creator The_Almighty_Duelist
  writeini sbot.ini modules $modules $+ _info Allows members to send messages to each other.
  writeini sbot.ini modules $module $+ _build 1.0.0.0
}

alias modins_inbox {
  writeini inbox.ini status installed yes
  writeini inbox.ini settings cut-off 20
  writeini inbox.ini settings join on
  writeini inbox.ini settings message on
  echo -a Inbox Installed Correctly
}

alias config_inbox {
  start inbox
}

alias delete_inbox {
  remove inbox.ini
  var %temp.1 $read($mfile, s, inbox)
  remini sbot.ini modules %temp.1 $+ _name
  remini sbot.ini modules %temp.1 $+ _creator
  remini sbot.ini modules %temp.1 $+ _info
  remini sbot.ini modules %temp.1 $+ _build
  echo -a Inbox Messaging System uninstalled.
}

alias cut_off {
  return $readini(inbox.ini,settings,cut-off)
}

alias note_join {
  return $readini(inbox.ini,settings,join)
}

alias note_message {
  return $readini(inbox.ini,settings,message)
}

dialog inbox {
  title Inbox
  option dbu
  size -1 -1 101 44
  check "Notify on join", 1, 1 1 100 10
  check "Notify on message", 2, 1 11 100 10
  text "Cut-off for old messages", 3, 1 22 79 10
  edit $cut_off, 4, 80 22 19 10
  button "Close", 5, 1 33 100 10
}

on *:DIALOG:inbox:*:*: {
  If ($devent == init) {
    If ($note_join == on) {
      did -c inbox 1
    }
    If ($note_message == on) {
      did -c inbox 2
    }
  }
  If ($devent == sclick) {
    If ($did == 1) {
      If ($note_join == on) {
        writeini inbox.ini settings join off
      }
      Else {
        writeini inbox.ini settings join on
      }
    }
    If ($did == 2) {
      If ($note_message == on) {
        writeini inbox.ini settings message off
      }
      Else {
        writeini inbox.ini settings message on
      }
    }
    If ($did == 5) {
      close inbox
    }
  }
  If ($devent == edit) {
    If ($did == 4) {
      writeini inbox.ini settings cut-off $did(4)
    }
  }
}

on *:JOIN:#: {
  If ($chan == $host_channel) {
    If ($readini(account.ini,$nick,registered) == yes ) {
      If ($note_join == on) {
        If ($readini(account.ini,$nick,new_notices) == yes ) {
          .notice $nick You have new messages! Type !inbox to see them.
        }
      }
    }
  }
}

Comments

Sign in to comment.
Tamaki   -  Apr 18, 2009

This is a module for Staff Bot 3. If you don't have Staff Bot 3, then you'll have to mod it to work without it.

 Respond  
^Neptune   -  Apr 18, 2009

It's ridiculous to make so many scripts that require another script. It may be to help new scripters but if I didn't know what I was doing I wouldn't use something as complicated as his scripts. Should just paste it and be done.

 Respond  
Tamaki   -  Apr 18, 2009

[insert name here]...don't hate, there really is no point in complaining
i simply don't care anymore

 Respond  
Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.