2017-09-28 22:16:34 +00:00
|
|
|
package main
|
|
|
|
|
2018-10-27 03:21:02 +00:00
|
|
|
import "github.com/Azareal/Gosora/common"
|
2017-11-11 04:06:16 +00:00
|
|
|
|
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
|
2019-02-10 05:52:26 +00:00
|
|
|
func initHeythere(plugin *common.Plugin) error {
|
|
|
|
plugin.AddHook("topic_reply_row_assign", heythereReply)
|
2017-09-28 22:16:34 +00:00
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
2019-02-10 05:52:26 +00:00
|
|
|
func deactivateHeythere(plugin *common.Plugin) {
|
|
|
|
plugin.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
|
|
|
|
}
|