Skip to content

Conversation

@ValwareIRC
Copy link
Contributor

Implements an event-driven script language.
Awaiting possible rewording in this PR due to renaming considerations.

Needs more work especially around escaping, this is unsafe to use on production servers.

Examples of scripts that currently work:

// When the server starts (or is rehashed)
on START:*:{
    isupport SCRIPT=1.0

    // global var in START event
    var %count 0
}

// Add a new command /REPORT and send reports (as a privmsg from the server) to #staff channel
new COMMAND:REPORT:{
    var %chan find_channel("#staff")
    if (%chan.name == $null) {
        sendnotice $client "Sorry, no staff are on right now"
        return
    }
    else {
        privmsg @%chan.name "[report] [nick: $client.name] [report: $1-]"
        sendnotice $client "Thank you for your report."
    }
}

// Do something when a client connects to the server
on CONNECT:*:{
    %count++
    sendnotice $client "You are the #%count connection!"
    if ($client issecure) {
        sendnotice $client "Thanks for using a secure connection!"
    }
    else {
        sendnotice $client "Consider connecting with TLS!"
    }
}

// Override the INVITE command and cry about it in #staff for some reason
on COMMAND:INVITE:{
    privmsg #staff "$client.name used /INVITE $1-"
}

// New oper-only command which quiet-ban's a nick in a channel
new COMMAND:QUIETBAN:{
    var %chan find_channel($1)
    var %target find_client($2)
    if ($client isoper) {
        mode %chan.name +b ~quiet:*!*@$target.host
    }
    else {
        notice $client "Permission denied"
    }
}

new COMMAND:CUSTOMQUIT:{
    svskill $client "Ping timeout: 204071794 years"
}

Implements an event-driven script language.
Awaiting possible rewording in this PR due to renaming considerations.

Needs more work especially around escaping, this is unsafe to use on production servers.

Examples of scripts that currently work:
```
// When the server starts (or is rehashed)
on START:*:{
    isupport SCRIPT=1.0

    // global var in START event
    var %count 0
}

// Add a new command /REPORT and send reports (as a privmsg from the server) to #staff channel
new COMMAND:REPORT:{
    var %chan find_channel("#staff")
    if (%chan.name == $null) {
        sendnotice $client "Sorry, no staff are on right now"
        return
    }
    else {
        privmsg @%chan.name "[report] [nick: $client.name] [report: $1-]"
        sendnotice $client "Thank you for your report."
    }
}

// Do something when a client connects to the server
on CONNECT:*:{
    %count++
    sendnotice $client "You are the #%count connection!"
    if ($client issecure) {
        sendnotice $client "Thanks for using a secure connection!"
    }
    else {
        sendnotice $client "Consider connecting with TLS!"
    }
}

// Override the INVITE command and cry about it in #staff for some reason
on COMMAND:INVITE:{
    privmsg #staff "$client.name used /INVITE $1-"
}

// New oper-only command which quiet-ban's a nick in a channel
new COMMAND:QUIETBAN:{
    var %chan find_channel($1)
    var %target find_client($2)
    if ($client isoper) {
        mode %chan.name +b ~quiet:*!*@$target.host
    }
    else {
        notice $client "Permission denied"
    }
}

new COMMAND:CUSTOMQUIT:{
    svskill $client "Ping timeout: 204071794 years"
}
```
Copilot AI review requested due to automatic review settings November 9, 2025 07:53
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Copilot wasn't able to review any files in this pull request.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@ValwareIRC ValwareIRC marked this pull request as draft November 9, 2025 07:53
@ObsidianIRC ObsidianIRC deleted a comment from coderabbitai bot Nov 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants