From 95eea11d19e479b43f8927dc72d230391e4aa4d3 Mon Sep 17 00:00:00 2001 From: zekroTJA Date: Sat, 17 Oct 2020 10:48:36 +0200 Subject: [PATCH 1/2] fix permissions middleware [#169] --- go.mod | 15 +++++++++------ go.sum | 22 ++++++++++++++++++++++ internal/core/middleware/permissions.go | 1 + 3 files changed, 32 insertions(+), 6 deletions(-) diff --git a/go.mod b/go.mod index b3f48c48..678bc6ca 100644 --- a/go.mod +++ b/go.mod @@ -3,6 +3,7 @@ module github.com/zekroTJA/shinpuru go 1.13 require ( + github.com/andybalholm/brotli v1.0.1 // indirect github.com/blend/go-sdk v2.0.0+incompatible // indirect github.com/bwmarrin/discordgo v0.22.0 github.com/bwmarrin/snowflake v0.3.0 @@ -10,7 +11,7 @@ require ( github.com/dgrijalva/jwt-go v3.2.0+incompatible github.com/gabriel-vasile/mimetype v1.1.1 github.com/generaltso/vibrant v0.0.0-20200703055536-90f922bee78c - github.com/go-ini/ini v1.58.0 // indirect + github.com/go-ini/ini v1.62.0 // indirect github.com/go-ozzo/ozzo-routing v2.1.4+incompatible // indirect github.com/go-redis/redis v6.15.9+incompatible github.com/go-sql-driver/mysql v1.5.0 @@ -18,6 +19,7 @@ require ( github.com/golang/gddo v0.0.0-20200715224205-051695c33a3f // indirect github.com/google/go-cmp v0.5.1 // indirect github.com/gorilla/websocket v1.4.2 // indirect + github.com/klauspost/compress v1.11.1 // indirect github.com/kylelemons/godebug v1.1.0 // indirect github.com/makeworld-the-better-one/go-isemoji v1.1.0 github.com/mattn/go-sqlite3 v2.0.3+incompatible @@ -29,14 +31,15 @@ require ( github.com/qiangxue/fasthttp-routing v0.0.0-20160225050629-6ccdc2a18d87 github.com/sahilm/fuzzy v0.1.0 github.com/smartystreets/goconvey v1.6.4 // indirect - github.com/valyala/fasthttp v1.15.1 + github.com/valyala/fasthttp v1.16.0 github.com/wcharczuk/go-chart v2.0.1+incompatible github.com/zekroTJA/ratelimit v0.0.0-20190321090824-219ca33049a5 - github.com/zekroTJA/shireikan v0.3.1 + github.com/zekroTJA/shireikan v0.3.2 github.com/zekroTJA/timedmap v1.2.0 - golang.org/x/crypto v0.0.0-20200728195943-123391ffb6de // indirect - golang.org/x/image v0.0.0-20200801110659-972c09e46d76 // indirect - golang.org/x/sys v0.0.0-20200814200057-3d37ad5750ed // indirect + golang.org/x/crypto v0.0.0-20201016220609-9e8e0b390897 // indirect + golang.org/x/image v0.0.0-20200927104501-e162460cd6b5 // indirect + golang.org/x/net v0.0.0-20201016165138-7b1cca2348c0 // indirect + golang.org/x/sys v0.0.0-20201017003518-b09fb700fbb7 // indirect golang.org/x/time v0.0.0-20200630173020-3af7569d3a1e gopkg.in/ini.v1 v1.58.0 // indirect gopkg.in/yaml.v2 v2.3.0 diff --git a/go.sum b/go.sum index 8aa7caef..f4b76c07 100644 --- a/go.sum +++ b/go.sum @@ -2,6 +2,8 @@ cloud.google.com/go v0.16.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMT github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/andybalholm/brotli v1.0.0 h1:7UCwP93aiSfvWpapti8g88vVVGp2qqtGyePsSuDafo4= github.com/andybalholm/brotli v1.0.0/go.mod h1:loMXtMfwqflxFJPmdbJO0a3KNoPuLBgiu3qAvBg8x/Y= +github.com/andybalholm/brotli v1.0.1 h1:KqhlKozYbRtJvsPrrEeXcO+N2l6NYT5A2QAFmSULpEc= +github.com/andybalholm/brotli v1.0.1/go.mod h1:loMXtMfwqflxFJPmdbJO0a3KNoPuLBgiu3qAvBg8x/Y= github.com/blend/go-sdk v2.0.0+incompatible h1:FL9X/of4ZYO5D2JJNI4vHrbXPfuSDbUa7h8JP9+E92w= github.com/blend/go-sdk v2.0.0+incompatible/go.mod h1:3GUb0YsHFNTJ6hsJTpzdmCUl05o8HisKjx5OAlzYKdw= github.com/bradfitz/gomemcache v0.0.0-20170208213004-1952afaa557d/go.mod h1:PmM6Mmwb0LSuEubjR8N7PtNe1KxZLtOUHtbeikc5h60= @@ -27,6 +29,8 @@ github.com/generaltso/vibrant v0.0.0-20200703055536-90f922bee78c h1:lSVqQVSCCCOz github.com/generaltso/vibrant v0.0.0-20200703055536-90f922bee78c/go.mod h1:QmLK0QXa+OA/VI1WiQNTCuqWgzF16WxDcKqQ6MIPr6Q= github.com/go-ini/ini v1.58.0 h1:cgk7et3XWr6o1NWWcEUEVao/AYecQQg50XXU+xOX0nM= github.com/go-ini/ini v1.58.0/go.mod h1:ByCAeIL28uOIIG0E3PJtZPDL8WnHpFKFOtgjp+3Ies8= +github.com/go-ini/ini v1.62.0 h1:7VJT/ZXjzqSrvtraFp4ONq80hTcRQth1c9ZnQ3uNQvU= +github.com/go-ini/ini v1.62.0/go.mod h1:ByCAeIL28uOIIG0E3PJtZPDL8WnHpFKFOtgjp+3Ies8= github.com/go-ozzo/ozzo-routing v2.1.4+incompatible h1:gQmNyAwMnBHr53Nma2gPTfVVc6i2BuAwCWPam2hIvKI= github.com/go-ozzo/ozzo-routing v2.1.4+incompatible/go.mod h1:hvoxy5M9SJaY0viZvcCsODidtUm5CzRbYKEWuQpr+2A= github.com/go-redis/redis v6.15.9+incompatible h1:K0pv1D7EQUjfyoMql+r/jZqCLizCGKFlFgcHWWmHQjg= @@ -70,6 +74,8 @@ github.com/jtolds/gls v4.20.0+incompatible h1:xdiiI2gbIgH/gLH7ADydsJ1uDOEzR8yvV7 github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU= github.com/klauspost/compress v1.10.7 h1:7rix8v8GpI3ZBb0nSozFRgbtXKv+hOe+qfEpZqybrAg= github.com/klauspost/compress v1.10.7/go.mod h1:aoV0uJVorq1K+umq18yTdKaF57EivdYsUV+/s2qKfXs= +github.com/klauspost/compress v1.11.1 h1:bPb7nMRdOZYDrpPMTA3EInUQrdgoBinqUuSwlGdKDdE= +github.com/klauspost/compress v1.11.1/go.mod h1:aoV0uJVorq1K+umq18yTdKaF57EivdYsUV+/s2qKfXs= github.com/kr/pretty v0.2.0 h1:s5hAObm+yFO5uHYt5dYjxi2rXrsnmRpJx4OYvIWUaQs= github.com/kr/pretty v0.2.0/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= @@ -126,6 +132,8 @@ github.com/valyala/bytebufferpool v1.0.0 h1:GqA5TC/0021Y/b9FG4Oi9Mr3q7XYx6Kllzaw github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc= github.com/valyala/fasthttp v1.15.1 h1:eRb5jzWhbCn/cGu3gNJMcOfPUfXgXCcQIOHjh9ajAS8= github.com/valyala/fasthttp v1.15.1/go.mod h1:YOKImeEosDdBPnxc0gy7INqi3m1zK6A+xl6TwOBhHCA= +github.com/valyala/fasthttp v1.16.0 h1:9zAqOYLl8Tuy3E5R6ckzGDJ1g8+pw15oQp2iL9Jl6gQ= +github.com/valyala/fasthttp v1.16.0/go.mod h1:YOKImeEosDdBPnxc0gy7INqi3m1zK6A+xl6TwOBhHCA= github.com/valyala/tcplisten v0.0.0-20161114210144-ceec8f93295a/go.mod h1:v3UYOV9WzVtRmSR+PDvWpU/qWl4Wa5LApYYX4ZtKbio= github.com/wcharczuk/go-chart v2.0.1+incompatible h1:0pz39ZAycJFF7ju/1mepnk26RLVLBCWz1STcD3doU0A= github.com/wcharczuk/go-chart v2.0.1+incompatible/go.mod h1:PF5tmL4EIx/7Wf+hEkpCqYi5He4u90sw+0+6FhrryuE= @@ -133,14 +141,21 @@ github.com/zekroTJA/ratelimit v0.0.0-20190321090824-219ca33049a5 h1:EryoK8mdGm7q github.com/zekroTJA/ratelimit v0.0.0-20190321090824-219ca33049a5/go.mod h1:5aXVBC8pKM3Tva/5YihZ0yOLD+ULDq5P73lpRuBSLNg= github.com/zekroTJA/shireikan v0.3.1 h1:47yGg4JS+OH9pRAFd1lEyqxhe62TLzlcbavy89cE7rY= github.com/zekroTJA/shireikan v0.3.1/go.mod h1:RwaE2svJ/dUzKIpw04gC0loA5rWAMU8eKKCRDnmck+4= +github.com/zekroTJA/shireikan v0.3.2 h1:rBJh2g/HDFQm8zAyA+f4lEpiPYLKIGUqjMsUGlV6+uc= +github.com/zekroTJA/shireikan v0.3.2/go.mod h1:RwaE2svJ/dUzKIpw04gC0loA5rWAMU8eKKCRDnmck+4= github.com/zekroTJA/timedmap v1.2.0 h1:6HqQF89K7oEYatCEuS7ylZSFkL8Yf7luJyBTbgAafyI= github.com/zekroTJA/timedmap v1.2.0/go.mod h1:ktlw5aYhoXQvOvWFL9SzltGXn1bQgJXxZzHJK4wQvsI= golang.org/x/crypto v0.0.0-20181030102418-4d3f4d9ffa16/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20200728195943-123391ffb6de h1:ikNHVSjEfnvz6sxdSPCaPt572qowuyMDMJLLm3Db3ig= golang.org/x/crypto v0.0.0-20200728195943-123391ffb6de/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/crypto v0.0.0-20201016220609-9e8e0b390897 h1:pLI5jrR7OSLijeIDcmRxNmw2api+jEfxLoykJVice/E= +golang.org/x/crypto v0.0.0-20201016220609-9e8e0b390897/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/image v0.0.0-20200801110659-972c09e46d76 h1:U7GPaoQyQmX+CBRWXKrvRzWTbd+slqeSh8uARsIyhAw= golang.org/x/image v0.0.0-20200801110659-972c09e46d76/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= +golang.org/x/image v0.0.0-20200927104501-e162460cd6b5 h1:QelT11PB4FXiDEXucrfNckHoFxwt8USGY1ajP1ZF5lM= +golang.org/x/image v0.0.0-20200927104501-e162460cd6b5/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= @@ -149,6 +164,8 @@ golang.org/x/net v0.0.0-20200520004742-59133d7f0dd7 h1:AeiKBIuRw3UomYXSbLy0Mc2dD golang.org/x/net v0.0.0-20200520004742-59133d7f0dd7/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= golang.org/x/net v0.0.0-20200602114024-627f9648deb9 h1:pNX+40auqi2JqRfOP1akLGtYcn15TUbkhwuCO3foqqM= golang.org/x/net v0.0.0-20200602114024-627f9648deb9/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20201016165138-7b1cca2348c0 h1:5kGOVHlq0euqwzgTC9Vu15p6fV1Wi0ArVi8da2urnVg= +golang.org/x/net v0.0.0-20201016165138-7b1cca2348c0/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/oauth2 v0.0.0-20170912212905-13449ad91cb2/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/sync v0.0.0-20170517211232-f52d1811a629/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -164,9 +181,14 @@ golang.org/x/sys v0.0.0-20200519105757-fe76b779f299/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20200602225109-6fdc65e7d980/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200814200057-3d37ad5750ed h1:J22ig1FUekjjkmZUM7pTKixYm8DvrYsvrBZdunYeIuQ= golang.org/x/sys v0.0.0-20200814200057-3d37ad5750ed/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20201017003518-b09fb700fbb7 h1:XtNJkfEjb4zR3q20BBBcYUykVOEMgZeIUOpBPfNYgxg= +golang.org/x/sys v0.0.0-20201017003518-b09fb700fbb7/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.2 h1:tW2bmiBqwgJj/UpqtC8EpXEZVYOwU0yG4iWbprSVAcs= golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= +golang.org/x/text v0.3.3 h1:cokOdA+Jmi5PJGXLlLllQSgYigAEfHXJAERHVMaCc2k= +golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/time v0.0.0-20170424234030-8be79e1e0910/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20200630173020-3af7569d3a1e h1:EHBhcS0mlXEAVwNyO2dLfjToGsyY4j24pTs2ScHnX7s= golang.org/x/time v0.0.0-20200630173020-3af7569d3a1e/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= diff --git a/internal/core/middleware/permissions.go b/internal/core/middleware/permissions.go index cf572340..52aa9b31 100644 --- a/internal/core/middleware/permissions.go +++ b/internal/core/middleware/permissions.go @@ -54,6 +54,7 @@ func (m *PermissionsMiddleware) Handle( if !ok { msg, _ := ctx.ReplyEmbedError("You are not permitted to use this command!", "Missing Permission") discordutil.DeleteMessageLater(ctx.GetSession(), msg, 8*time.Second) + return false, nil } return true, nil From c250b136f0a2bdebd6d31b9913fbd65e4cb38ea8 Mon Sep 17 00:00:00 2001 From: zekroTJA Date: Sat, 17 Oct 2020 11:06:56 +0200 Subject: [PATCH 2/2] update lock command visuals --- go.mod | 2 +- go.sum | 2 ++ internal/commands/cmdlock.go | 16 +++++++++++++--- internal/util/embeds.go | 25 +++++++++++++++++++++++++ 4 files changed, 41 insertions(+), 4 deletions(-) diff --git a/go.mod b/go.mod index 678bc6ca..d1a46c35 100644 --- a/go.mod +++ b/go.mod @@ -34,7 +34,7 @@ require ( github.com/valyala/fasthttp v1.16.0 github.com/wcharczuk/go-chart v2.0.1+incompatible github.com/zekroTJA/ratelimit v0.0.0-20190321090824-219ca33049a5 - github.com/zekroTJA/shireikan v0.3.2 + github.com/zekroTJA/shireikan v0.3.3 github.com/zekroTJA/timedmap v1.2.0 golang.org/x/crypto v0.0.0-20201016220609-9e8e0b390897 // indirect golang.org/x/image v0.0.0-20200927104501-e162460cd6b5 // indirect diff --git a/go.sum b/go.sum index f4b76c07..e53d2920 100644 --- a/go.sum +++ b/go.sum @@ -143,6 +143,8 @@ github.com/zekroTJA/shireikan v0.3.1 h1:47yGg4JS+OH9pRAFd1lEyqxhe62TLzlcbavy89cE github.com/zekroTJA/shireikan v0.3.1/go.mod h1:RwaE2svJ/dUzKIpw04gC0loA5rWAMU8eKKCRDnmck+4= github.com/zekroTJA/shireikan v0.3.2 h1:rBJh2g/HDFQm8zAyA+f4lEpiPYLKIGUqjMsUGlV6+uc= github.com/zekroTJA/shireikan v0.3.2/go.mod h1:RwaE2svJ/dUzKIpw04gC0loA5rWAMU8eKKCRDnmck+4= +github.com/zekroTJA/shireikan v0.3.3 h1:sJ5ZjRBb1XxVQy+z312OluV6ViS2SVgLu0M+0ufoerw= +github.com/zekroTJA/shireikan v0.3.3/go.mod h1:RwaE2svJ/dUzKIpw04gC0loA5rWAMU8eKKCRDnmck+4= github.com/zekroTJA/timedmap v1.2.0 h1:6HqQF89K7oEYatCEuS7ylZSFkL8Yf7luJyBTbgAafyI= github.com/zekroTJA/timedmap v1.2.0/go.mod h1:ktlw5aYhoXQvOvWFL9SzltGXn1bQgJXxZzHJK4wQvsI= golang.org/x/crypto v0.0.0-20181030102418-4d3f4d9ffa16/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= diff --git a/internal/commands/cmdlock.go b/internal/commands/cmdlock.go index bd8627e4..b4dc1370 100644 --- a/internal/commands/cmdlock.go +++ b/internal/commands/cmdlock.go @@ -90,6 +90,11 @@ func (c *CmdLock) getTargetChan(ctx shireikan.Context) (ch *discordgo.Channel, e } func (c *CmdLock) lock(target *discordgo.Channel, ctx shireikan.Context, db database.Database) error { + procMsg := util.SendEmbed(ctx.GetSession(), target.ID, ":clock4: Locking channel...", "", static.ColorEmbedGray) + if procMsg.Error() != nil { + return procMsg.Error() + } + encodedPerms, err := c.encodePermissionOverrides(target.PermissionOverwrites) if err != nil { return err @@ -118,7 +123,7 @@ func (c *CmdLock) lock(target *discordgo.Channel, ctx shireikan.Context, db data // The info message needs to be sent before all permissions are set // to prevent occuring errors due to potential missing permissions. - err = util.SendEmbed(ctx.GetSession(), target.ID, + err = procMsg.Edit( fmt.Sprintf("This channel is chat-locked by %s.\nYou may not be able to chat "+ "into this channel until the channel is unlocked again.", ctx.GetUser().Mention()), "", static.ColorEmbedOrange). @@ -168,6 +173,11 @@ func (c *CmdLock) lock(target *discordgo.Channel, ctx shireikan.Context, db data } func (c *CmdLock) unlock(target *discordgo.Channel, ctx shireikan.Context, db database.Database, executorID, encodedPerms string) error { + procMsg := util.SendEmbed(ctx.GetSession(), target.ID, ":clock4: Unlocking channel...", "", static.ColorEmbedGray) + if procMsg.Error() != nil { + return procMsg.Error() + } + permissionOverrides, err := c.decodePermissionOverrrides(encodedPerms) if err != nil { return err @@ -185,14 +195,14 @@ func (c *CmdLock) unlock(target *discordgo.Channel, ctx shireikan.Context, db da } if failed > 0 { - return util.SendEmbed(ctx.GetSession(), target.ID, + return procMsg.Edit( fmt.Sprintf("This channel is now unlocked. You can now chat here again.\n*(Unlocked by %s)*\n\n"+ "**Attention:** %d permission actions failed on reset!", ctx.GetUser().Mention(), failed), "", static.ColorEmbedOrange). Error() } - return util.SendEmbed(ctx.GetSession(), target.ID, + return procMsg.Edit( fmt.Sprintf("This channel is now unlocked. You can now chat here again.\n*(Unlocked by %s)*", ctx.GetUser().Mention()), "", static.ColorEmbedGreen). Error() diff --git a/internal/util/embeds.go b/internal/util/embeds.go index d5af96ef..a43b216f 100644 --- a/internal/util/embeds.go +++ b/internal/util/embeds.go @@ -33,6 +33,31 @@ func (emb *EmbedMessage) Error() error { return emb.err } +// Edit updates the current embed message with +// the given content replacing the internal message +// and error of this embed instance. +func (emb *EmbedMessage) Edit(content string, title string, color int) *EmbedMessage { + newEmb := &discordgo.MessageEmbed{ + Description: content, + Color: color, + } + + newEmb.Title = title + if color == 0 { + newEmb.Color = static.ColorEmbedDefault + } + + return emb.EditRaw(newEmb) +} + +// EditRaw updates the current embed message with +// the given raw embed replacing the internal message +// and error of this embed instance. +func (emb *EmbedMessage) EditRaw(newEmb *discordgo.MessageEmbed) *EmbedMessage { + emb.Message, emb.err = emb.s.ChannelMessageEditEmbed(emb.ChannelID, emb.ID, newEmb) + return emb +} + // SendEmbed creates an discordgo.MessageEmbed from the passed // content, title and color and sends it to the specified channel. //