Allow disabling of archive channel
This commit is contained in:
parent
ebb0235606
commit
5dbfdd836a
@ -14,7 +14,7 @@ type Settings struct {
|
||||
WelcomeMessaage string `json:"welcome_message"`
|
||||
TicketLimit uint8 `json:"ticket_limit"`
|
||||
Category uint64 `json:"category,string"`
|
||||
ArchiveChannel uint64 `json:"archive_channel,string"`
|
||||
ArchiveChannel *uint64 `json:"archive_channel,string"`
|
||||
NamingScheme database.NamingScheme `json:"naming_scheme"`
|
||||
PingEveryone bool `json:"ping_everyone"`
|
||||
UsersCanClose bool `json:"users_can_close"`
|
||||
|
@ -207,9 +207,14 @@ func (s *Settings) updateCategory(channels []channel.Channel, guildId uint64) bo
|
||||
}
|
||||
|
||||
func (s *Settings) updateArchiveChannel(channels []channel.Channel, guildId uint64) bool {
|
||||
if s.ArchiveChannel == nil {
|
||||
go dbclient.Client.ArchiveChannel.Set(guildId, nil)
|
||||
return true
|
||||
}
|
||||
|
||||
var valid bool
|
||||
for _, ch := range channels {
|
||||
if ch.Id == s.ArchiveChannel && ch.Type == channel.ChannelTypeGuildText {
|
||||
if ch.Id == *s.ArchiveChannel && ch.Type == channel.ChannelTypeGuildText {
|
||||
valid = true
|
||||
break
|
||||
}
|
||||
|
@ -1,4 +1,9 @@
|
||||
<Dropdown {col1} {col2} {col3} {col4} bind:value label={label}>
|
||||
{#if withNull}
|
||||
<option value="null">
|
||||
{nullLabel}
|
||||
</option>
|
||||
{/if}
|
||||
{#each channels as channel}
|
||||
{#if channel.type === 0}
|
||||
<option value="{channel.id}">
|
||||
@ -14,6 +19,8 @@
|
||||
export let value;
|
||||
export let label;
|
||||
export let channels = [];
|
||||
export let withNull = false;
|
||||
export let nullLabel = "Disabled";
|
||||
|
||||
export let col1 = false;
|
||||
export let col2 = false;
|
||||
|
@ -16,7 +16,7 @@
|
||||
bind:value={data.welcome_message}/>
|
||||
</div>
|
||||
<div class="row">
|
||||
<ChannelDropdown label="Archive Channel" col2=true channels={channels} bind:value={data.archive_channel}/>
|
||||
<ChannelDropdown label="Archive Channel" col2=true channels={channels} withNull={true} bind:value={data.archive_channel}/>
|
||||
<CategoryDropdown label="Channel Category" col2=true channels={channels} bind:value={data.category}/>
|
||||
</div>
|
||||
<div class="row">
|
||||
|
6
go.mod
6
go.mod
@ -6,8 +6,8 @@ require (
|
||||
github.com/BurntSushi/toml v0.3.1
|
||||
github.com/TicketsBot/archiverclient v0.0.0-20210220155137-a562b2f1bbbb
|
||||
github.com/TicketsBot/common v0.0.0-20210910205523-7ce93fba6fa5
|
||||
github.com/TicketsBot/database v0.0.0-20211030133445-3b8906e1b64a
|
||||
github.com/TicketsBot/worker v0.0.0-20210910205947-89f7bd5ccf67
|
||||
github.com/TicketsBot/database v0.0.0-20211102194216-65aaa0ce6ce9
|
||||
github.com/TicketsBot/worker v0.0.0-20211102194549-f7058a7791fa
|
||||
github.com/apex/log v1.1.2
|
||||
github.com/boj/redistore v0.0.0-20180917114910-cd5dcc76aeff // indirect
|
||||
github.com/getsentry/sentry-go v0.11.0
|
||||
@ -23,7 +23,7 @@ require (
|
||||
github.com/jackc/pgx/v4 v4.7.1
|
||||
github.com/pasztorpisti/qs v0.0.0-20171216220353-8d6c33ee906c
|
||||
github.com/pkg/errors v0.9.1
|
||||
github.com/rxdn/gdl v0.0.0-20210921120128-02188fdcfd88
|
||||
github.com/rxdn/gdl v0.0.0-20211030160619-a8772c268ca4
|
||||
github.com/sirupsen/logrus v1.5.0
|
||||
golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9
|
||||
)
|
||||
|
6
go.sum
6
go.sum
@ -18,11 +18,15 @@ github.com/TicketsBot/database v0.0.0-20211030123522-eeed94443867 h1:2tYF3avpUUY
|
||||
github.com/TicketsBot/database v0.0.0-20211030123522-eeed94443867/go.mod h1:72oWvH/Gq1iKeXCZhVRZn1JFbNVC5iAgERZWTrEarEo=
|
||||
github.com/TicketsBot/database v0.0.0-20211030133445-3b8906e1b64a h1:nn8rmdIXR4jY3JsE+pyf6Ff0LOAYvHjx8F8E+InWaRk=
|
||||
github.com/TicketsBot/database v0.0.0-20211030133445-3b8906e1b64a/go.mod h1:72oWvH/Gq1iKeXCZhVRZn1JFbNVC5iAgERZWTrEarEo=
|
||||
github.com/TicketsBot/database v0.0.0-20211102194216-65aaa0ce6ce9 h1:x4xs4IynlfDwpPTTcVbYjt5h1VmL9AeUW9ZFY31dyP0=
|
||||
github.com/TicketsBot/database v0.0.0-20211102194216-65aaa0ce6ce9/go.mod h1:72oWvH/Gq1iKeXCZhVRZn1JFbNVC5iAgERZWTrEarEo=
|
||||
github.com/TicketsBot/logarchiver v0.0.0-20200423221245-a3f92edf8c14/go.mod h1:whts8TRxrAF4WuDuEAMllkWA/inKem0NhDEFeyuoOvE=
|
||||
github.com/TicketsBot/ttlcache v1.6.1-0.20200405150101-acc18e37b261 h1:NHD5GB6cjlkpZFjC76Yli2S63/J2nhr8MuE6KlYJpQM=
|
||||
github.com/TicketsBot/ttlcache v1.6.1-0.20200405150101-acc18e37b261/go.mod h1:2zPxDAN2TAPpxUPjxszjs3QFKreKrQh5al/R3cMXmYk=
|
||||
github.com/TicketsBot/worker v0.0.0-20210910205947-89f7bd5ccf67 h1:ZZt7+rCmj+za01PVkgaflrJecLVi2laly1Gjz81YMlk=
|
||||
github.com/TicketsBot/worker v0.0.0-20210910205947-89f7bd5ccf67/go.mod h1:n6gqs84FS2GxcVJrA2uznGf6WC5qXVfeEF2fr181TNY=
|
||||
github.com/TicketsBot/worker v0.0.0-20211102194549-f7058a7791fa h1:/4Fp1qNYG6Svsjv4swrfUlOipKpdWD3fdiPhrlqe4r4=
|
||||
github.com/TicketsBot/worker v0.0.0-20211102194549-f7058a7791fa/go.mod h1:ZX0b2l/SHb6OI3avFkh/0ztqdaqcENjHcMZF12T73AA=
|
||||
github.com/ajg/form v1.5.1/go.mod h1:uL1WgH+h2mgNtvBq0339dVnzXdBETtL2LeUXaIv25UY=
|
||||
github.com/apex/log v1.1.2 h1:bnDuVoi+o98wOdVqfEzNDlY0tcmBia7r4YkjS9EqGYk=
|
||||
github.com/apex/log v1.1.2/go.mod h1:SyfRweFO+TlkIJ3DVizTSeI1xk7jOIIqOnUPZQTTsww=
|
||||
@ -360,6 +364,8 @@ github.com/rxdn/gdl v0.0.0-20210527173953-25dde613ff0a/go.mod h1:jvcb1N6AdaGx3/e
|
||||
github.com/rxdn/gdl v0.0.0-20210906182609-337cb3c44a4c/go.mod h1:rENs8TxMsoYSJRssegNS/+fy18NCI9EUdCJX8R83PlY=
|
||||
github.com/rxdn/gdl v0.0.0-20210921120128-02188fdcfd88 h1:DpLqFmCtCAREiRK5nq4SYJGOQV3G6qTTz7H4C4Wb1kU=
|
||||
github.com/rxdn/gdl v0.0.0-20210921120128-02188fdcfd88/go.mod h1:rENs8TxMsoYSJRssegNS/+fy18NCI9EUdCJX8R83PlY=
|
||||
github.com/rxdn/gdl v0.0.0-20211030160619-a8772c268ca4 h1:vHSTqcCCZZwlj6trBUj3tqys5hnKbBf9J6mtuG7DvgM=
|
||||
github.com/rxdn/gdl v0.0.0-20211030160619-a8772c268ca4/go.mod h1:rENs8TxMsoYSJRssegNS/+fy18NCI9EUdCJX8R83PlY=
|
||||
github.com/ryanuber/columnize v2.1.0+incompatible/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts=
|
||||
github.com/satori/go.uuid v1.2.0/go.mod h1:dA0hQrYB0VpLJoorglMZABFdXlWrHn1NEOzdhQKdks0=
|
||||
github.com/schollz/closestmatch v2.1.0+incompatible/go.mod h1:RtP1ddjLong6gTkbtmuhtR2uUrrJOpYzYRvbcPAid+g=
|
||||
|
Loading…
x
Reference in New Issue
Block a user