Fix a bunch of warnings / typos
This commit is contained in:
parent
b2ea90dbef
commit
1e342b145e
113
.idea/dictionaries/qbit.xml
generated
113
.idea/dictionaries/qbit.xml
generated
@ -1,7 +1,120 @@
|
|||||||
<component name="ProjectDictionaryState">
|
<component name="ProjectDictionaryState">
|
||||||
<dictionary name="qbit">
|
<dictionary name="qbit">
|
||||||
<words>
|
<words>
|
||||||
|
<w>adressing</w>
|
||||||
|
<w>akesi</w>
|
||||||
|
<w>alasa</w>
|
||||||
|
<w>animally</w>
|
||||||
|
<w>anpa</w>
|
||||||
|
<w>appid</w>
|
||||||
|
<w>awen</w>
|
||||||
|
<w>bluey</w>
|
||||||
|
<w>botsnack</w>
|
||||||
|
<w>callsign</w>
|
||||||
|
<w>chronologic</w>
|
||||||
|
<w>covid</w>
|
||||||
|
<w>datas</w>
|
||||||
|
<w>descr</w>
|
||||||
|
<w>diskv</w>
|
||||||
|
<w>errorf</w>
|
||||||
|
<w>esun</w>
|
||||||
|
<w>feder</w>
|
||||||
|
<w>gomatrix</w>
|
||||||
|
<w>hawkard</w>
|
||||||
|
<w>highfives</w>
|
||||||
|
<w>highfiving</w>
|
||||||
|
<w>insa</w>
|
||||||
|
<w>jaki</w>
|
||||||
|
<w>jelo</w>
|
||||||
|
<w>kalama</w>
|
||||||
|
<w>kasi</w>
|
||||||
|
<w>kepeken</w>
|
||||||
|
<w>kili</w>
|
||||||
|
<w>kiwen</w>
|
||||||
|
<w>kule</w>
|
||||||
|
<w>kulupu</w>
|
||||||
|
<w>kute</w>
|
||||||
|
<w>lape</w>
|
||||||
|
<w>laso</w>
|
||||||
|
<w>lawa</w>
|
||||||
|
<w>lete</w>
|
||||||
|
<w>lili</w>
|
||||||
|
<w>linja</w>
|
||||||
|
<w>lipu</w>
|
||||||
|
<w>liquify</w>
|
||||||
|
<w>loje</w>
|
||||||
|
<w>luka</w>
|
||||||
|
<w>lukin</w>
|
||||||
|
<w>lupa</w>
|
||||||
|
<w>mcchunkie</w>
|
||||||
|
<w>mctest</w>
|
||||||
|
<w>meli</w>
|
||||||
|
<w>metaphorisch</w>
|
||||||
|
<w>mije</w>
|
||||||
|
<w>moar</w>
|
||||||
|
<w>moku</w>
|
||||||
|
<w>moli</w>
|
||||||
|
<w>monsi</w>
|
||||||
|
<w>muddler</w>
|
||||||
|
<w>mumsy</w>
|
||||||
|
<w>musi</w>
|
||||||
|
<w>namako</w>
|
||||||
|
<w>nanpa</w>
|
||||||
|
<w>nasin</w>
|
||||||
|
<w>nena</w>
|
||||||
|
<w>nimi</w>
|
||||||
|
<w>nois</w>
|
||||||
|
<w>noka</w>
|
||||||
|
<w>openweathermap</w>
|
||||||
|
<w>pakala</w>
|
||||||
|
<w>pali</w>
|
||||||
|
<w>palisa</w>
|
||||||
|
<w>pana</w>
|
||||||
|
<w>pilin</w>
|
||||||
|
<w>pimeja</w>
|
||||||
|
<w>pini</w>
|
||||||
|
<w>pipi</w>
|
||||||
|
<w>poka</w>
|
||||||
|
<w>poki</w>
|
||||||
|
<w>pona</w>
|
||||||
|
<w>regexes</w>
|
||||||
|
<w>retrives</w>
|
||||||
|
<w>sama</w>
|
||||||
|
<w>seli</w>
|
||||||
|
<w>selo</w>
|
||||||
|
<w>seme</w>
|
||||||
|
<w>sewi</w>
|
||||||
|
<w>sijelo</w>
|
||||||
|
<w>sike</w>
|
||||||
|
<w>sina</w>
|
||||||
|
<w>sinpin</w>
|
||||||
|
<w>sitelen</w>
|
||||||
|
<w>sona</w>
|
||||||
|
<w>soweli</w>
|
||||||
|
<w>sprintf</w>
|
||||||
|
<w>statuse</w>
|
||||||
|
<w>storer</w>
|
||||||
|
<w>suli</w>
|
||||||
|
<w>sunnily</w>
|
||||||
|
<w>suno</w>
|
||||||
|
<w>supa</w>
|
||||||
|
<w>suwi</w>
|
||||||
|
<w>tacticle</w>
|
||||||
|
<w>taso</w>
|
||||||
|
<w>tawa</w>
|
||||||
|
<w>telo</w>
|
||||||
|
<w>tenpo</w>
|
||||||
|
<w>thebigboard</w>
|
||||||
|
<w>toki</w>
|
||||||
|
<w>tomo</w>
|
||||||
|
<w>unpa</w>
|
||||||
|
<w>utala</w>
|
||||||
|
<w>vegetal</w>
|
||||||
<w>veryhigh</w>
|
<w>veryhigh</w>
|
||||||
|
<w>walo</w>
|
||||||
|
<w>waso</w>
|
||||||
|
<w>wawa</w>
|
||||||
|
<w>wett</w>
|
||||||
</words>
|
</words>
|
||||||
</dictionary>
|
</dictionary>
|
||||||
</component>
|
</component>
|
21
.idea/inspectionProfiles/Project_Default.xml
generated
Normal file
21
.idea/inspectionProfiles/Project_Default.xml
generated
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
<component name="InspectionProjectProfileManager">
|
||||||
|
<profile version="1.0">
|
||||||
|
<option name="myName" value="Project Default" />
|
||||||
|
<inspection_tool class="GoUnhandledErrorResult" enabled="true" level="WARNING" enabled_by_default="true">
|
||||||
|
<methods>
|
||||||
|
<method importPath="hash" receiver="Hash" name="Write" />
|
||||||
|
<method importPath="strings" receiver="*Builder" name="Write" />
|
||||||
|
<method importPath="strings" receiver="*Builder" name="WriteByte" />
|
||||||
|
<method importPath="bytes" receiver="*Buffer" name="WriteRune" />
|
||||||
|
<method importPath="bytes" receiver="*Buffer" name="Write" />
|
||||||
|
<method importPath="bytes" receiver="*Buffer" name="WriteString" />
|
||||||
|
<method importPath="strings" receiver="*Builder" name="WriteString" />
|
||||||
|
<method importPath="bytes" receiver="*Buffer" name="WriteByte" />
|
||||||
|
<method importPath="strings" receiver="*Builder" name="WriteRune" />
|
||||||
|
<method importPath="math/rand" receiver="*Rand" name="Read" />
|
||||||
|
<method importPath="io" receiver="ReadCloser" name="Close" />
|
||||||
|
<method importPath="io" receiver="*PipeWriter" name="Close" />
|
||||||
|
</methods>
|
||||||
|
</inspection_tool>
|
||||||
|
</profile>
|
||||||
|
</component>
|
4
.idea/mcchunkie.iml
generated
4
.idea/mcchunkie.iml
generated
@ -2,7 +2,9 @@
|
|||||||
<module type="WEB_MODULE" version="4">
|
<module type="WEB_MODULE" version="4">
|
||||||
<component name="Go" enabled="true" />
|
<component name="Go" enabled="true" />
|
||||||
<component name="NewModuleRootManager">
|
<component name="NewModuleRootManager">
|
||||||
<content url="file://$MODULE_DIR$" />
|
<content url="file://$MODULE_DIR$">
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/db" />
|
||||||
|
</content>
|
||||||
<orderEntry type="inheritedJdk" />
|
<orderEntry type="inheritedJdk" />
|
||||||
<orderEntry type="sourceFolder" forTests="false" />
|
<orderEntry type="sourceFolder" forTests="false" />
|
||||||
</component>
|
</component>
|
||||||
|
5
main.go
5
main.go
@ -19,8 +19,7 @@ import (
|
|||||||
const header = `
|
const header = `
|
||||||
# mcchunkie
|
# mcchunkie
|
||||||
|
|
||||||
[![builds.sr.ht status](https://builds.sr.ht/~qbit/mcchunkie.svg)](https://builds.sr.ht/~qbit/mcchunkie?)
|
[![builds.sr.ht status](https://builds.sr.ht/~qbit/mcchunkie.svg)](https://builds.sr.ht/~qbit/mcchunkie?)`
|
||||||
`
|
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
var username, shortName, password, userID, accessToken, server, db, avatar, botOwner string
|
var username, shortName, password, userID, accessToken, server, db, avatar, botOwner string
|
||||||
@ -66,7 +65,7 @@ func main() {
|
|||||||
|
|
||||||
if doc {
|
if doc {
|
||||||
fmt.Println(header)
|
fmt.Println(header)
|
||||||
fmt.Println("|Plugin Name|Match|Description|")
|
fmt.Println("\n|Plugin Name|Match|Description|")
|
||||||
fmt.Println("|----|---|---|")
|
fmt.Println("|----|---|---|")
|
||||||
for _, p := range plugins.Plugs {
|
for _, p := range plugins.Plugs {
|
||||||
fmt.Printf("|%s|`%s`|%s|\n", p.Name(), p.Re(), p.Descr())
|
fmt.Printf("|%s|`%s`|%s|\n", p.Name(), p.Re(), p.Descr())
|
||||||
|
@ -6,6 +6,7 @@ import (
|
|||||||
"golang.org/x/crypto/ssh/terminal"
|
"golang.org/x/crypto/ssh/terminal"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
//noinspection GoUnresolvedReference
|
||||||
func prompt(p string) (string, error) {
|
func prompt(p string) (string, error) {
|
||||||
oldState, err := terminal.MakeRaw(0)
|
oldState, err := terminal.MakeRaw(0)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -123,7 +123,10 @@ func SendText(c *gomatrix.Client, roomID, message string) error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
c.SendText(roomID, message)
|
_, err = c.SendText(roomID, message)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
_, err = c.UserTyping(roomID, false, 0)
|
_, err = c.UserTyping(roomID, false, 0)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -140,7 +143,10 @@ func SendHTML(c *gomatrix.Client, roomID, message string) error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
c.SendMessageEvent(roomID, "m.room.message", gomatrix.GetHTMLMessage("m.text", message))
|
_, err = c.SendMessageEvent(roomID, "m.room.message", gomatrix.GetHTMLMessage("m.text", message))
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
_, err = c.UserTyping(roomID, false, 0)
|
_, err = c.UserTyping(roomID, false, 0)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -159,7 +165,10 @@ func SendMDNotice(c *gomatrix.Client, roomID, message string) error {
|
|||||||
|
|
||||||
md := []byte(message)
|
md := []byte(message)
|
||||||
html := markdown.ToHTML(md, nil, nil)
|
html := markdown.ToHTML(md, nil, nil)
|
||||||
c.SendMessageEvent(roomID, "m.room.message", gomatrix.GetHTMLMessage("m.notice", string(html)))
|
_, err = c.SendMessageEvent(roomID, "m.room.message", gomatrix.GetHTMLMessage("m.notice", string(html)))
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
_, err = c.UserTyping(roomID, false, 0)
|
_, err = c.UserTyping(roomID, false, 0)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -172,8 +181,7 @@ func SendMDNotice(c *gomatrix.Client, roomID, message string) error {
|
|||||||
func SendMD(c *gomatrix.Client, roomID, message string) error {
|
func SendMD(c *gomatrix.Client, roomID, message string) error {
|
||||||
md := []byte(message)
|
md := []byte(message)
|
||||||
html := markdown.ToHTML(md, nil, nil)
|
html := markdown.ToHTML(md, nil, nil)
|
||||||
SendHTML(c, roomID, string(html))
|
return SendHTML(c, roomID, string(html))
|
||||||
return nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// SendImage takes an image and sends it!.
|
// SendImage takes an image and sends it!.
|
||||||
@ -182,7 +190,7 @@ func SendImage(c *gomatrix.Client, roomID string, img *image.RGBA) error {
|
|||||||
|
|
||||||
go func() {
|
go func() {
|
||||||
defer w.Close()
|
defer w.Close()
|
||||||
png.Encode(w, img)
|
_ = png.Encode(w, img)
|
||||||
}()
|
}()
|
||||||
|
|
||||||
mediaURL, err := c.UploadToContentRepo(r, "image/png", 0)
|
mediaURL, err := c.UploadToContentRepo(r, "image/png", 0)
|
||||||
|
@ -34,7 +34,10 @@ type testResp struct {
|
|||||||
|
|
||||||
func TestHTTPRequestDoJSON(t *testing.T) {
|
func TestHTTPRequestDoJSON(t *testing.T) {
|
||||||
ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||||
fmt.Fprintln(w, `{"test":"success"}`)
|
_, err := fmt.Fprintln(w, `{"test":"success"}`)
|
||||||
|
if err != nil {
|
||||||
|
t.Error(err)
|
||||||
|
}
|
||||||
}))
|
}))
|
||||||
defer ts.Close()
|
defer ts.Close()
|
||||||
|
|
||||||
|
@ -21,7 +21,7 @@ func (h *Source) Re() string {
|
|||||||
return `(?i)where is your (source|code)`
|
return `(?i)where is your (source|code)`
|
||||||
}
|
}
|
||||||
|
|
||||||
// Match determins if someone is asking about the source code
|
// Match determines if someone is asking about the source code
|
||||||
func (h *Source) Match(user, msg string) bool {
|
func (h *Source) Match(user, msg string) bool {
|
||||||
re := regexp.MustCompile(h.Re())
|
re := regexp.MustCompile(h.Re())
|
||||||
return re.MatchString(msg) && ToMe(user, msg)
|
return re.MatchString(msg) && ToMe(user, msg)
|
||||||
|
@ -23,7 +23,7 @@ func (h *Thanks) Re() string {
|
|||||||
return `(?i)^thank you|thank you$|^thanks|thanks$|^ty|ty$`
|
return `(?i)^thank you|thank you$|^thanks|thanks$|^ty|ty$`
|
||||||
}
|
}
|
||||||
|
|
||||||
// Match determins if we are being thanked
|
// Match determines if we are being thanked
|
||||||
func (h *Thanks) Match(user, msg string) bool {
|
func (h *Thanks) Match(user, msg string) bool {
|
||||||
re := regexp.MustCompile(h.Re())
|
re := regexp.MustCompile(h.Re())
|
||||||
return re.MatchString(msg) && ToMe(user, msg)
|
return re.MatchString(msg) && ToMe(user, msg)
|
||||||
|
@ -21,7 +21,7 @@ func (h *Wb) Re() string {
|
|||||||
return `(?i)^welcome back|welcome back$|^wb|wb$`
|
return `(?i)^welcome back|welcome back$|^wb|wb$`
|
||||||
}
|
}
|
||||||
|
|
||||||
// Match determins if we are welcomed back
|
// Match determines if we are welcomed back
|
||||||
func (h *Wb) Match(user, msg string) bool {
|
func (h *Wb) Match(user, msg string) bool {
|
||||||
re := regexp.MustCompile(h.Re())
|
re := regexp.MustCompile(h.Re())
|
||||||
return re.MatchString(msg) && ToMe(user, msg)
|
return re.MatchString(msg) && ToMe(user, msg)
|
||||||
|
Loading…
Reference in New Issue
Block a user