Skip to content

Commit

Permalink
gofmt project
Browse files Browse the repository at this point in the history
  • Loading branch information
FlameInTheDark committed Mar 26, 2019
1 parent ca6d35b commit e7e227f
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 15 deletions.
10 changes: 5 additions & 5 deletions api/news/news.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ package news

import (
"encoding/json"
"errors"
"fmt"
"github.com/FlameInTheDark/dtbot/bot"
"errors"
"net/http"
)

Expand Down Expand Up @@ -32,7 +32,7 @@ type NewsArticeleSourceData struct {
}

// GetNews returns news string
func GetNews(ctx *bot.Context) error{
func GetNews(ctx *bot.Context) error {
var (
result NewsResponseData
category string
Expand All @@ -56,11 +56,11 @@ func GetNews(ctx *bot.Context) error{
if len(result.Articles) > 0 {
emb := bot.NewEmbed(ctx.Loc("news"))
for i := 0; i < ctx.Conf.News.Articles; i++ {
emb.Field(result.Articles[i].Title, result.Articles[i].Description + "\n" + result.Articles[i].URL, false)
emb.Field(result.Articles[i].Title, result.Articles[i].Description+"\n"+result.Articles[i].URL, false)
}
emb.Footer(fmt.Sprintf("%v %v",ctx.Loc("requested_by"), ctx.Message.Author.Username))
emb.Footer(fmt.Sprintf("%v %v", ctx.Loc("requested_by"), ctx.Message.Author.Username))
emb.Color(ctx.Conf.General.EmbedColor)
_,_=ctx.Discord.ChannelMessageSendEmbed(ctx.Message.ChannelID, emb.GetEmbed())
_, _ = ctx.Discord.ChannelMessageSendEmbed(ctx.Message.ChannelID, emb.GetEmbed())
return nil
} else {
return errors.New(ctx.Loc("news_404"))
Expand Down
2 changes: 1 addition & 1 deletion bot/session.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ func newSession(newGuildID, newChannelID string, conn *Connection, volume float3
guildID: newGuildID,
ChannelID: newChannelID,
connection: conn,
Volume: volume,
Volume: volume,
}
return session
}
Expand Down
6 changes: 3 additions & 3 deletions bot/twitch.go
Original file line number Diff line number Diff line change
Expand Up @@ -159,14 +159,14 @@ func (t *Twitch) Update() {
if !s.IsOnline {
t.Guilds[s.Guild].Streams[s.Login].IsOnline = true
t.DB.UpdateStream(s)
imgUrl := strings.Replace(stream.ThumbnailURL, "{width}", "320", -1)
imgUrl = strings.Replace(imgUrl, "{height}", "180", -1)
imgURL := strings.Replace(stream.ThumbnailURL, "{width}", "320", -1)
imgURL = strings.Replace(imgURL, "{height}", "180", -1)
emb := NewEmbed(stream.Title).
URL(fmt.Sprintf("http://www.twitch.tv/%v", s.Login)).
Author(s.Name, "", s.ProfileImageURL).
Field("Viewers", fmt.Sprintf("%v", stream.Viewers), true).
Field("Game", games[stream.GameID].Name, true).
AttachImgURL(imgUrl).
AttachImgURL(imgURL).
Color(t.Conf.General.EmbedColor)
if s.CustomMessage != "" {
emb.Content = s.CustomMessage
Expand Down
6 changes: 3 additions & 3 deletions cmd/debugcommand.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,15 @@ func DebugCommand(ctx bot.Context) {
case "voice":
var resp string
resp += fmt.Sprintf("Voice connections: %v\n", len(ctx.Discord.VoiceConnections))
for i,c := range ctx.Discord.VoiceConnections {
for i, c := range ctx.Discord.VoiceConnections {
resp += i + " | G: " + c.GuildID + " | C: " + c.ChannelID + "\n"
}
ctx.ReplyEmbed("Debug", resp)
case "leavevoice":
if v,ok := ctx.Discord.VoiceConnections[ctx.Args[1]];ok {
if v, ok := ctx.Discord.VoiceConnections[ctx.Args[1]]; ok {
err := v.Disconnect()
if err != nil {
ctx.ReplyEmbed("Debug", "Voice: " + err.Error())
ctx.ReplyEmbed("Debug", "Voice: "+err.Error())
}
} else {
ctx.ReplyEmbed("Debug", "Voice connection not found")
Expand Down
2 changes: 1 addition & 1 deletion cmd/helpcommand.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ func HelpCommand(ctx bot.Context) {
ctx.ReplyEmbed(ctx.Loc("help"), ctx.Loc("help_command_!v"))
case "b":
ctx.ReplyEmbed(ctx.Loc("help"), ctx.Loc("help_command_!b"))
if (ctx.IsAdmin()) {
if ctx.IsAdmin() {
ctx.ReplyEmbed(ctx.Loc("help"), ctx.Loc("help_command_!b_admin"))
}
case "y":
Expand Down
2 changes: 1 addition & 1 deletion cmd/newscommand.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@ import (
// NewsCommand News handler
func NewsCommand(ctx bot.Context) {
ctx.MetricsCommand("news", "main")
_= news.GetNews(&ctx)
_ = news.GetNews(&ctx)
}
2 changes: 1 addition & 1 deletion cmd/twitchcommand.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ func TwitchCommand(ctx bot.Context) {
case "add":
ctx.MetricsCommand("twitch", "add")
if len(ctx.Args) > 2 {
username, err := ctx.Twitch.AddStreamer(ctx.Guild.ID, ctx.Message.ChannelID, ctx.Args[1], strings.Join(ctx.Args[2:]," "))
username, err := ctx.Twitch.AddStreamer(ctx.Guild.ID, ctx.Message.ChannelID, ctx.Args[1], strings.Join(ctx.Args[2:], " "))
if err != nil {
ctx.ReplyEmbed("Twitch", ctx.Loc("twitch_add_error"))
} else {
Expand Down

0 comments on commit e7e227f

Please sign in to comment.