Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Jonathan Keller
committed
Feb 9, 2017
1 parent
528c2bd
commit 5278f48
Showing
6 changed files
with
82 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
// | ||
// CommandCheckThreshold.swift | ||
// FireAlarm | ||
// | ||
// Created by NobodyNada on 2/9/17. | ||
// | ||
// | ||
|
||
import Foundation | ||
import SwiftChatSE | ||
|
||
class CommandCheckThreshold: Command { | ||
override class func usage() -> [String] { | ||
return ["threshold", "check threshold", "get threshold", "current threshold"] | ||
} | ||
|
||
override func run() throws { | ||
message.room.postReply("The threshold for this room is \(message.room.threshold) (*higher* thresholds report more posts).", to: message) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
// | ||
// CommandSetThreshold.swift | ||
// FireAlarm | ||
// | ||
// Created by NobodyNada on 2/9/17. | ||
// | ||
// | ||
|
||
import Foundation | ||
import SwiftChatSE | ||
|
||
class CommandSetThreshold: Command { | ||
override public class func usage() -> [String] { | ||
return ["set threshold *", "change threshold *", "change threshold to *"] | ||
} | ||
|
||
override public class func privileges() -> ChatUser.Privileges { | ||
return .filter | ||
} | ||
|
||
override func run() throws { | ||
guard let newThreshold = (arguments.first.map({Int($0)}) ?? nil) else { | ||
message.reply("Please specify a valid threshold.") | ||
return | ||
} | ||
|
||
message.room.threshold = newThreshold | ||
|
||
message.reply("The threshold for this room has been set to \(newThreshold) (*higher* thresholds report more posts).") | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters