2017-09-28 22:16:34 +00:00
|
|
|
package main
|
|
|
|
|
2019-04-20 04:55:22 +00:00
|
|
|
import c "github.com/Azareal/Gosora/common"
|
2017-11-11 04:06:16 +00:00
|
|
|
|
2017-09-28 22:16:34 +00:00
|
|
|
func init() {
|
2019-04-20 04:55:22 +00:00
|
|
|
c.Plugins.Add(&c.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-04-20 04:55:22 +00:00
|
|
|
func initHeythere(plugin *c.Plugin) error {
|
2019-02-10 05:52:26 +00:00
|
|
|
plugin.AddHook("topic_reply_row_assign", heythereReply)
|
2017-09-28 22:16:34 +00:00
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
2019-04-20 04:55:22 +00:00
|
|
|
func deactivateHeythere(plugin *c.Plugin) {
|
2019-02-10 05:52:26 +00:00
|
|
|
plugin.RemoveHook("topic_reply_row_assign", heythereReply)
|
2017-09-28 22:16:34 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func heythereReply(data ...interface{}) interface{} {
|
2019-04-20 04:55:22 +00:00
|
|
|
currentUser := data[0].(*c.TopicPage).Header.CurrentUser
|
|
|
|
reply := data[1].(*c.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
|
|
|
|
}
|