Validate welcome message content
This commit is contained in:
parent
70b4015173
commit
707744de74
@ -297,6 +297,11 @@ func (p *panelBody) doValidations(ctx *gin.Context, guildId uint64) bool {
|
|||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if !p.validateWelcomeMessage() {
|
||||||
|
ctx.JSON(400, utils.ErrorStr("The welcome message you provided has no content"))
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
if !p.verifyButtonLabel() {
|
if !p.verifyButtonLabel() {
|
||||||
ctx.JSON(400, utils.ErrorStr("Button labels cannot be longer than 80 characters"))
|
ctx.JSON(400, utils.ErrorStr("Button labels cannot be longer than 80 characters"))
|
||||||
return false
|
return false
|
||||||
@ -520,6 +525,14 @@ func (p *panelBody) verifyNamingScheme() bool {
|
|||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (p *panelBody) validateWelcomeMessage() bool {
|
||||||
|
return p.WelcomeMessage == nil || !(p.WelcomeMessage.Title == nil &&
|
||||||
|
p.WelcomeMessage.Description == nil &&
|
||||||
|
len(p.WelcomeMessage.Fields) == 0 &&
|
||||||
|
p.WelcomeMessage.ImageUrl == nil &&
|
||||||
|
p.WelcomeMessage.ThumbnailUrl == nil)
|
||||||
|
}
|
||||||
|
|
||||||
func getRoleHashSet(guildId uint64) (*collections.Set[uint64], error) {
|
func getRoleHashSet(guildId uint64) (*collections.Set[uint64], error) {
|
||||||
ctx, err := botcontext.ContextForGuild(guildId)
|
ctx, err := botcontext.ContextForGuild(guildId)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user