fix: updated Error messages to better fit the HTTP standard

Signed-off-by: moonleay <contact@moonleay.net>
This commit is contained in:
moonleay 2023-12-19 10:59:31 +01:00
parent c1536b259b
commit d8753a8c1f
Signed by: moonleay
GPG key ID: 82667543CCD715FB
4 changed files with 29 additions and 11 deletions

View file

@ -51,7 +51,7 @@ class FeatureManageExtension : Extension() {
this.respond {
this.embed {
this.color = EmbedColor.ERROR.color
this.title = "403: Forbidden"
this.title = "401: Not Authorized"
this.description =
"You cannot edit features, as you don't have the Administrator permission."
this.footer {

View file

@ -49,13 +49,31 @@ class SendPlannerExtension : Extension() {
.hasPermission(Permission.Administrator)
) {
val res = this.respond {
this.content = "You need to be an administrator to use this command."
this.embed {
this.color = EmbedColor.ERROR.color
this.title = "401: Not Authorized"
this.description =
"You need the Administrator permission to use this command."
this.footer {
this.icon = user.asUser().avatar?.cdnUrl?.toUrl()
this.text = MessageUtil.getFooter(user)
}
}
}
res.delete()
return@action
}
val res = this.respond {
this.content = "OK."
this.embed {
this.color = EmbedColor.INFO.color
this.title = "200: Success"
this.description = "Sending the planner.\n" +
"This may take a while, please be patient."
this.footer {
this.icon = user.asUser().avatar?.cdnUrl?.toUrl()
this.text = MessageUtil.getFooter(user)
}
}
}
res.delete() // Delete the response
val c = this.getChannel().asChannel()

View file

@ -44,9 +44,9 @@ class UpdateRolesExtension : Extension() {
this.respond {
this.embed {
this.color = EmbedColor.ERROR.color
this.title = "403: Forbidden"
this.title = "401: Not Authorized"
this.description =
"You cannot update roles, as you don't have the Administrator permission."
"You need the Administrator permission to use this command."
this.footer {
this.icon = user.asUser().avatar?.cdnUrl?.toUrl()
this.text = MessageUtil.getFooter(user)

View file

@ -166,14 +166,14 @@ object TimeManager : IFeature {
EmbedColor.SUCCESS,
"200: Success",
"The feature was enabled in channel ${args.channel.data.name.value}",
u.asUser().username + "#" + u.asUser().discriminator
u.asUser().username
)
}
return MessageUtil.getEmbed(
EmbedColor.ERROR,
"403: Forbidden",
"409: Conflict",
"The feature is already enabled in this channel.",
u.asUser().username + "#" + u.asUser().discriminator
u.asUser().username
)
}
@ -192,15 +192,15 @@ object TimeManager : IFeature {
EmbedColor.SUCCESS,
"200: Success",
"The feature was disabled.",
u.asUser().username + "#" + u.asUser().discriminator
u.asUser().username
)
}
// Do nothing; not in db
return MessageUtil.getEmbed(
EmbedColor.ERROR,
"403: Forbidden",
"409: Conflict",
"The feature is already disabled in this channel.",
u.asUser().username + "#" + u.asUser().discriminator
u.asUser().username
)
}
}