Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2e0762ee0f | ||
|
|
ccb450e543 | ||
|
|
c34f475084 | ||
|
|
1a7d9b824f |
@@ -79,7 +79,7 @@ func requestCommandFunc(ctx disgoman.Context, args []string) {
|
||||
if c.Admin {
|
||||
_, _ = ctx.Session.ChannelMessageSend(c.ID,
|
||||
fmt.Sprintf("%s\n"+
|
||||
"New Request ID %d "+
|
||||
"New Request ID %d\n"+
|
||||
"%s has requested assistance: \n"+
|
||||
"```\n%s\n```\n"+
|
||||
"Requested At: %s\n"+
|
||||
@@ -154,7 +154,7 @@ func closeCommandFunc(ctx disgoman.Context, args []string) {
|
||||
continue
|
||||
}
|
||||
if request.Author != closer && !closer.IsStaff && !closer.IsAdmin {
|
||||
if !discord_utils.IsGuildMod(ctx, closer) || !discord_utils.IsGuildAdmin(ctx, closer) {
|
||||
if !discord_utils.IsGuildMod(ctx, closer) && !discord_utils.IsGuildAdmin(ctx, closer) {
|
||||
discord_utils.SendErrorMessage(ctx, fmt.Sprintf("You are not authorized to close %d", id), nil)
|
||||
continue
|
||||
}
|
||||
@@ -248,7 +248,7 @@ func listCommandFunc(ctx disgoman.Context, args []string) {
|
||||
commentCount = 0
|
||||
}
|
||||
_, _ = ctx.Send(fmt.Sprintf("```md\n"+
|
||||
"< Request ID Requested By >\n"+
|
||||
"< Request ID Requested By >\n"+
|
||||
"< %-11d %23s >\n"+
|
||||
"%s\n\n"+
|
||||
"Comments: %d\n"+
|
||||
@@ -288,7 +288,7 @@ func commentCommandFunc(ctx disgoman.Context, args []string) {
|
||||
discord_utils.SendErrorMessage(ctx, "Please include the ID of the request to update.", err)
|
||||
return
|
||||
}
|
||||
message := strings.Join(args[1:len(args)-1], " ")
|
||||
message := strings.Join(args[1:len(args)], " ")
|
||||
author, err := services.UserService.GetOrCreateUser(ctx.Message.Author.ID)
|
||||
if err != nil {
|
||||
discord_utils.SendErrorMessage(ctx, "Sorry, there was an issue finding your user account", err)
|
||||
@@ -318,7 +318,7 @@ func commentCommandFunc(ctx disgoman.Context, args []string) {
|
||||
var commentString string
|
||||
var commentStrings []string
|
||||
commentString = fmt.Sprintf("Comment added:\n```md\n"+
|
||||
"< Request ID Requested By >\n"+
|
||||
"< Request ID Requested By >\n"+
|
||||
"< %-11d %23s >\n"+
|
||||
"%s\n\n"+
|
||||
"Comments: Not Implemented Yet\n"+
|
||||
@@ -328,7 +328,7 @@ func commentCommandFunc(ctx disgoman.Context, args []string) {
|
||||
request.ID,
|
||||
discord_utils.GetDisplayName(ctx, request.Author.ID),
|
||||
request.Content,
|
||||
request.RequestedAt.Format("2006-01-02 15:04:05 MST"),
|
||||
request.RequestedAt.Format("2006-01-02 15:04:05"),
|
||||
discord_utils.GetChannelName(ctx, request.Channel.ID),
|
||||
)
|
||||
for _, c := range comments {
|
||||
@@ -339,13 +339,15 @@ func commentCommandFunc(ctx disgoman.Context, args []string) {
|
||||
cs := fmt.Sprintf("```md\n%s\n- %s At %s\n```\n",
|
||||
c.Content,
|
||||
discord_utils.GetDisplayName(ctx, c.Author.ID),
|
||||
c.CommentAt.Format("2006-01-02 15:04:05 MST"),
|
||||
c.CommentAt.Format("2006-01-02 15:04:05"),
|
||||
)
|
||||
if len(commentString+cs) >= 2000 {
|
||||
commentStrings = append(commentStrings, commentString)
|
||||
commentString = ""
|
||||
}
|
||||
commentString += cs
|
||||
}
|
||||
commentStrings = append(commentStrings, commentString)
|
||||
for _, c := range channels {
|
||||
if c.Admin {
|
||||
for _, s := range commentStrings {
|
||||
@@ -353,6 +355,8 @@ func commentCommandFunc(ctx disgoman.Context, args []string) {
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
log.Println(err)
|
||||
}
|
||||
_, err = ctx.Send(fmt.Sprintf("%s your comment has been added.", ctx.Message.Author.Mention()))
|
||||
dmChannel, err := ctx.Session.UserChannelCreate(request.Author.ID)
|
||||
@@ -365,7 +369,7 @@ func commentCommandFunc(ctx disgoman.Context, args []string) {
|
||||
request.ID,
|
||||
discord_utils.GetChannelName(ctx, ctx.Channel.ID),
|
||||
request.Content,
|
||||
comment.Content,
|
||||
message,
|
||||
))
|
||||
|
||||
}
|
||||
@@ -407,38 +411,38 @@ func viewCommandFunc(ctx disgoman.Context, args []string) {
|
||||
discord_utils.SendErrorMessage(ctx, "You are not authorized to view that request", nil)
|
||||
return
|
||||
}
|
||||
comments, _ := services.RequestService.RequestComments(request)
|
||||
comments, err := services.RequestService.RequestComments(request)
|
||||
if err != nil {
|
||||
discord_utils.SendErrorMessage(ctx, "There was an error getting the comments.", err)
|
||||
}
|
||||
var commentString string
|
||||
var commentStrings []string
|
||||
commentString = fmt.Sprintf("Comment added:\n```md\n"+
|
||||
"< Request ID Requested By >\n"+
|
||||
commentString = fmt.Sprintf("```md\n"+
|
||||
"< Request ID Requested By >\n"+
|
||||
"< %-11d %23s >\n"+
|
||||
"%s\n\n"+
|
||||
"Comments: Not Implemented Yet\n"+
|
||||
"Requested At: %s\n"+
|
||||
"In: %s\n"+
|
||||
"```",
|
||||
request.ID,
|
||||
discord_utils.GetDisplayName(ctx, request.Author.ID),
|
||||
request.Content,
|
||||
request.RequestedAt.Format("2006-01-02 15:04:05 MST"),
|
||||
request.RequestedAt.Format("2006-01-02 15:04:05"),
|
||||
discord_utils.GetChannelName(ctx, request.Channel.ID),
|
||||
)
|
||||
for _, c := range comments {
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
continue
|
||||
}
|
||||
cs := fmt.Sprintf("```md\n%s\n- %s At %s\n```\n",
|
||||
c.Content,
|
||||
discord_utils.GetDisplayName(ctx, c.Author.ID),
|
||||
c.CommentAt.Format("2006-01-02 15:04:05 MST"),
|
||||
c.CommentAt.Format("2006-01-02 15:04:05"),
|
||||
)
|
||||
if len(commentString+cs) >= 2000 {
|
||||
commentStrings = append(commentStrings, commentString)
|
||||
commentString = ""
|
||||
}
|
||||
commentString += cs
|
||||
}
|
||||
commentStrings = append(commentStrings, commentString)
|
||||
for _, c := range commentStrings {
|
||||
_, _ = ctx.Send(c)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user