2017-09-28 22:16:34 +00:00
|
|
|
package main
|
|
|
|
|
2017-11-11 04:06:16 +00:00
|
|
|
import "./common"
|
|
|
|
|
2017-09-28 22:16:34 +00:00
|
|
|
func init() {
|
2018-08-04 11:46:36 +00:00
|
|
|
common.Plugins.Add(&common.Plugin{UName: "heythere", Name: "Hey There", Author: "Azareal", URL: "https://github.com/Azareal", Init: initHeythere, Deactivate: deactivateHeythere})
|
2017-09-28 22:16:34 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// init_heythere is separate from init() as we don't want the plugin to run if the plugin is disabled
|
|
|
|
func initHeythere() error {
|
2017-11-11 04:06:16 +00:00
|
|
|
common.Plugins["heythere"].AddHook("topic_reply_row_assign", heythereReply)
|
2017-09-28 22:16:34 +00:00
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
func deactivateHeythere() {
|
2017-11-11 04:06:16 +00:00
|
|
|
common.Plugins["heythere"].RemoveHook("topic_reply_row_assign", heythereReply)
|
2017-09-28 22:16:34 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func heythereReply(data ...interface{}) interface{} {
|
2018-04-22 12:33:56 +00:00
|
|
|
currentUser := data[0].(*common.TopicPage).Header.CurrentUser
|
2017-11-11 04:06:16 +00:00
|
|
|
reply := data[1].(*common.ReplyUser)
|
2017-09-28 22:16:34 +00:00
|
|
|
reply.Content = "Hey there, " + currentUser.Name + "!"
|
|
|
|
reply.ContentHtml = "Hey there, " + currentUser.Name + "!"
|
|
|
|
reply.Tag = "Auto"
|
|
|
|
return nil
|
|
|
|
}
|