-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
See the releases section for full change list
- Loading branch information
zingmars
committed
Oct 11, 2015
1 parent
4d12905
commit 82faf2d
Showing
19 changed files
with
411 additions
and
55 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,16 @@ | ||
(29.09.2015) v0.0.0 - Initial commit | ||
(06.10.2015) v1.0.0 - Initial commit to github | ||
(29.09.2015) v0.0.0 | ||
+ Initial commit | ||
(06.10.2015) v1.0.0 | ||
+ Initial commit to github | ||
+ A bot that allows connecting to a cbot.ws chatbox and implements various plugins | ||
(11.10.2015) v1.1.0 | ||
+) You can now set plugin settings from CLI (if they implement the function) | ||
+) Implemented privilege system for plugins. | ||
+) New default plugin - Time manager. Either outputs current time (in any time zone) or time until a specified time/date. | ||
+) New default plugin - You can now ban specific users from using the bot | ||
+) New default plugin - Honourable user (bot admin) manager. | ||
|
||
*) Fixed plugin: Deadbox check. The plugin never properly set the time of the last message, so it never worked. | ||
*) Fixed plugin: LastSeen should now properly greet specific users if they haven't posted for ~24hrs | ||
*) There is now a function that allows you to get the current UNIX time. It's in the settings class. | ||
*) Release.zip should now be extractable by all zip archivers, not just the very modern ones. |
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 |
---|---|---|
|
@@ -2,3 +2,4 @@ | |
#Tue Oct 06 10:28:36 UTC 2015 | ||
LastSeen= | ||
StreamerList=zingmars\:0\\0 | ||
HonourableUsers= |
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 @@ | ||
Cbox class: | ||
+) Have it check login state every couple of hours | ||
*) Fix characters going missing when sending a message | ||
*) Fix custom emotes being in <img> tags (have them appear as emote: <emotename>) | ||
*) Since cbox automatically html encodes the messages, decode them back to their respective characters | ||
|
||
CLI class: | ||
*) All of the CLI commands should have some sort of result indicators | ||
*) Fix CLI crashing on some exceptions, even if they are caught | ||
*) Make CLI chat have output that is independent of input | ||
|
||
Plugin loader class: | ||
*) Find a way to make Class loader non-case sensitive | ||
|
||
Plugins: | ||
+) Write a plugin that allows managing the bot the same way you can do it from CLI. (Have them share the function sets?) | ||
+) Finish the quotes plugin | ||
*) Rewrite AdminCommands | ||
*) Get a JSON parser library for LastSeen and TwitchCheck plugins, implement it | ||
*) Implement a way for plugins to register their commands to avoid duplicate commands and allow easier @help output |
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,78 @@ | ||
/** | ||
* Created by zingmars on 11.10.2015. | ||
*/ | ||
package BotPlugins | ||
import Containers.PluginBufferItem | ||
|
||
public class AbuserList : BasePlugin() | ||
{ | ||
override fun pubInit() :Boolean | ||
{ | ||
return true | ||
} | ||
override fun connector(buffer : PluginBufferItem) :Boolean | ||
{ | ||
var message = buffer.message.split(" ") | ||
when(message[0].toLowerCase()) { | ||
"@ignorelist" -> { | ||
var ignored = settings?.GetSetting("AbuserList") as String | ||
var isAdmin = handler?.isPluginAdmin(buffer.userName) as Boolean | ||
if(message[1] != "") { | ||
controller?.AddToBoxBuffer("Users banned from using the bot: " + ignored) | ||
} else { | ||
if (isAdmin) { | ||
if(message[1] == "add") { | ||
if(message[2] == "") { | ||
controller?.AddToBoxBuffer("Please enter an username") | ||
} else { | ||
AddIgnored(message[2]) | ||
} | ||
} else if (message[1] == "remove") { | ||
if(message[2] == "") { | ||
controller?.AddToBoxBuffer("Please enter an username") | ||
} else { | ||
if(!RemoveIgnored(message[2])) { | ||
controller?.AddToBoxBuffer(message[2] + " is not in the ignored list.") | ||
} | ||
} | ||
} | ||
} else { | ||
controller?.AddToBoxBuffer("Insufficient rights") | ||
} | ||
} | ||
} | ||
} | ||
return true | ||
} | ||
override fun executeCommand(command :String) :String | ||
{ | ||
var action = command.split(",") | ||
when(action[0].toLowerCase()) { | ||
"add" -> { return "Result: " + AddIgnored(action[1]).toString()} | ||
"remove" -> { return "Result: " + RemoveIgnored(action[1]).toString() } | ||
else -> { return "Incorrect command"} | ||
} | ||
} | ||
|
||
private fun AddIgnored(name :String) :Boolean | ||
{ | ||
var ignorelist = settings?.GetSetting("AbuserList") as String | ||
if(!ignorelist.contains(name)) { | ||
settings?.SetSetting("AbuserList", ignorelist+","+name) | ||
logger?.LogPlugin(this.pluginName as String, "User ignored: " + name) | ||
return true | ||
} | ||
return false | ||
} | ||
private fun RemoveIgnored(name :String) :Boolean | ||
{ | ||
var ignorelist = settings?.GetSetting("AbuserList") as String | ||
if(ignorelist.contains(name)) { | ||
ignorelist = ignorelist.substring(0, ignorelist.indexOf(name)-1) + ignorelist.substring(ignorelist.indexOf(name)+name.length()) | ||
settings?.SetSetting("AbuserList", ignorelist) | ||
logger?.LogPlugin(this.pluginName as String, "Removed ignored user: " + name) | ||
return true | ||
} | ||
return false | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
/** | ||
* Allows adding bot admins | ||
* Created by zingmars on 11.10.2015. | ||
*/ | ||
package BotPlugins | ||
import Containers.PluginBufferItem | ||
|
||
public class HonourableUsers : BasePlugin() | ||
{ | ||
override fun pubInit() :Boolean | ||
{ | ||
return true | ||
} | ||
override fun connector(buffer : PluginBufferItem) :Boolean | ||
{ | ||
var message = buffer.message.split(" ") | ||
when(message[0].toLowerCase()) { | ||
"@admins" -> { | ||
var admins = settings?.GetSetting("HonourableUsers").toString() | ||
var isAdmin = handler?.isPluginAdmin(buffer.userName) as Boolean | ||
if(message[1] != "") { | ||
controller?.AddToBoxBuffer("Bot administrators: " + admins) | ||
} else { | ||
if(isAdmin) { | ||
if(message[1] == "add") { | ||
if(message[2] == "") { | ||
controller?.AddToBoxBuffer("Please enter username") | ||
} else { | ||
AddAdmin(message[2]) | ||
} | ||
} else if (message[1] == "remove") { | ||
if(message[2] == "") { | ||
controller?.AddToBoxBuffer("Please enter username") | ||
} else { | ||
if(!RemoveAdmin(message[2])) { | ||
controller?.AddToBoxBuffer(message[2]+" is not an admin.") | ||
} | ||
} | ||
} | ||
} else { | ||
controller?.AddToBoxBuffer("Insufficient rights") | ||
} | ||
} | ||
} | ||
} | ||
return true | ||
} | ||
override fun executeCommand(command :String) :String | ||
{ | ||
var action = command.split(",") | ||
when(action[0].toLowerCase()) { | ||
"add" -> { return "Result: " + AddAdmin(action[1]).toString()} | ||
"remove" -> { return "Result: " + RemoveAdmin(action[1]).toString() } | ||
else -> { return "Incorrect command"} | ||
} | ||
} | ||
|
||
// Admin management functions | ||
private fun AddAdmin(name :String) :Boolean | ||
{ | ||
var admins = settings?.GetSetting("HonourableUsers") as String | ||
if(!admins.contains(name)) { | ||
settings?.SetSetting("HonourableUsers", admins+","+name) | ||
logger?.LogPlugin(this.pluginName as String, "Adding admin: " + name) | ||
return true | ||
} | ||
return false | ||
} | ||
private fun RemoveAdmin(name :String) :Boolean | ||
{ | ||
var admins = settings?.GetSetting("HonourableUsers") as String | ||
if(admins.contains(name)) { | ||
admins = admins.substring(0, admins.indexOf(name)-1) + admins.substring(admins.indexOf(name)+name.length()) | ||
settings?.SetSetting("HonourableUsers", admins) | ||
logger?.LogPlugin(this.pluginName as String, "Removed admin: " + name) | ||
return true | ||
} | ||
return false | ||
} | ||
} | ||
|
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,48 @@ | ||
/** | ||
* Return a quote. | ||
* Created by zingmars on 11.10.2015. | ||
*/ | ||
package BotPlugins | ||
import Containers.PluginBufferItem | ||
|
||
public class Quotes : BasePlugin() | ||
{ | ||
override fun pubInit() :Boolean | ||
{ | ||
// Load quotes DB | ||
return false // Not implemented yet | ||
} | ||
override fun connector(buffer : PluginBufferItem) :Boolean | ||
{ | ||
var message = buffer.message.split(" ") | ||
when(message[0].toLowerCase()) { | ||
"@quote" -> { | ||
var isAdmin = handler?.isPluginAdmin(buffer.userName) as Boolean | ||
if(message[1] != "") { | ||
// Select specific quote | ||
} else { | ||
if(isAdmin) { | ||
if(message[1] == "add") { | ||
// Add a quote. Check for privileges. | ||
} else if(message[1] == "remove") { | ||
|
||
} | ||
else { | ||
// Select a random quote | ||
} | ||
} else { | ||
|
||
} | ||
} | ||
} | ||
} | ||
return true | ||
} | ||
override fun executeCommand(command :String) :String | ||
{ | ||
// Reload quotes | ||
// Add | ||
// Remove | ||
return "" | ||
} | ||
} |
Oops, something went wrong.