diff --git a/mods/macro.go b/mods/macro.go index 5f9c9ef..8018545 100644 --- a/mods/macro.go +++ b/mods/macro.go @@ -29,9 +29,10 @@ func initmacro() { defer file.Close() err = json.NewDecoder(file).Decode(¯os) if err != nil { - log.Println("WARN: Could not load macros (malformed or unreadable file): " + err.Error()) + log.Println("[macro] WARN: Could not load macros (malformed or unreadable file): " + err.Error()) return } + log.Printf("[macro] Loaded %d macros from %s\n", len(macros), *macropath) } func macro(broker *tg.Broker, update tg.APIMessage) { @@ -66,11 +67,11 @@ func macro(broker *tg.Broker, update tg.APIMessage) { func savemacros() { file, err := os.Create(*macropath) if err != nil { - log.Println("WARN: Could not open macro db: " + err.Error()) + log.Println("[macro] WARN: Could not open macro db: " + err.Error()) return } err = json.NewEncoder(file).Encode(macros) if err != nil { - log.Println("WARN: Could not save macros into file: " + err.Error()) + log.Println("[macro] WARN: Could not save macros into file: " + err.Error()) } } diff --git a/mods/main.go b/mods/main.go index 0e1c0f9..a84e120 100644 --- a/mods/main.go +++ b/mods/main.go @@ -42,12 +42,18 @@ var mods = map[string]Mod{ } func initmods() { + var enabledmods []string for name, mod := range mods { log.Printf("Initializing %s..", name) if mod.OnInit != nil { mod.OnInit() } + enabledmods = append(enabledmods, name) } + log.Println("===============================") + log.Println("All mods have been initialized!") + log.Println("===============================") + log.Println("Active modules: " + strings.Join(enabledmods, ", ")) } func dispatch(broker *tg.Broker, update tg.APIMessage) { diff --git a/mods/memegen.go b/mods/memegen.go index 69b7bab..f81f061 100644 --- a/mods/memegen.go +++ b/mods/memegen.go @@ -33,6 +33,8 @@ func initmeme() { memeFontData = draw2d.FontData{"impact", draw2d.FontFamilySans, 0} draw2d.RegisterFont(memeFontData, font) + + log.Println("[meme] Loaded!") } func memegen(broker *tg.Broker, update tg.APIMessage) { diff --git a/mods/snapchat.go b/mods/snapchat.go index f720d70..d578684 100644 --- a/mods/snapchat.go +++ b/mods/snapchat.go @@ -40,6 +40,8 @@ func initsnapchat() { snapFontData = draw2d.FontData{"sourcesans", draw2d.FontFamilySans, draw2d.FontStyleBold} draw2d.RegisterFont(snapFontData, font) + + log.Println("[snapchat] Loaded!") } func snapchat(broker *tg.Broker, update tg.APIMessage) { diff --git a/mods/unsplash.go b/mods/unsplash.go index 4a7720c..dba2976 100644 --- a/mods/unsplash.go +++ b/mods/unsplash.go @@ -37,6 +37,8 @@ func initunsplash() { quoteFontData = draw2d.FontData{"gillmt", draw2d.FontFamilySans, draw2d.FontStyleBold} draw2d.RegisterFont(quoteFontData, font) + + log.Println("[unsplash] Loaded!") } func unsplash(broker *tg.Broker, update tg.APIMessage) { @@ -132,7 +134,6 @@ func unsplash(broker *tg.Broker, update tg.APIMessage) { // Still too big? Decrease font size again iter := 0 for width*1.2 > iwidth && iter < 10 { - log.Println("Warning, resizing!") scale *= (0.9 - 0.05*float64(iter)) gc.SetFontSize(scale) left, top, right, bottom = gc.GetStringBounds(texts[longid])