Compare commits

...

2 commits

Author SHA1 Message Date
24aa1b5d67
[quote] Fix: Add primary key to quote table
in order to allow migrating them using copy-database

Signed-off-by: Knut Ahlers <knut@ahlers.me>
2023-12-17 14:39:33 +01:00
2772286b71
[editor] Improve wording and visibility for bot connection
Signed-off-by: Knut Ahlers <knut@ahlers.me>
2023-12-17 13:29:53 +01:00
2 changed files with 8 additions and 7 deletions

View file

@ -13,6 +13,7 @@ import (
type ( type (
quote struct { quote struct {
ID uint64 `gorm:"primaryKey"`
Channel string `gorm:"not null;uniqueIndex:ensure_sort_idx;size:32"` Channel string `gorm:"not null;uniqueIndex:ensure_sort_idx;size:32"`
CreatedAt int64 `gorm:"uniqueIndex:ensure_sort_idx"` CreatedAt int64 `gorm:"uniqueIndex:ensure_sort_idx"`
Quote string Quote string
@ -22,7 +23,7 @@ type (
func AddQuote(db database.Connector, channel, quoteStr string) error { func AddQuote(db database.Connector, channel, quoteStr string) error {
return errors.Wrap( return errors.Wrap(
helpers.RetryTransaction(db.DB(), func(tx *gorm.DB) error { helpers.RetryTransaction(db.DB(), func(tx *gorm.DB) error {
return tx.Create(quote{ return tx.Create(&quote{
Channel: channel, Channel: channel,
CreatedAt: time.Now().UnixNano(), CreatedAt: time.Now().UnixNano(),
Quote: quoteStr, Quote: quoteStr,
@ -121,7 +122,7 @@ func SetQuotes(db database.Connector, channel string, quotes []string) error {
t := time.Now() t := time.Now()
for _, quoteStr := range quotes { for _, quoteStr := range quotes {
if err := tx.Create(quote{ if err := tx.Create(&quote{
Channel: channel, Channel: channel,
CreatedAt: t.UnixNano(), CreatedAt: t.UnixNano(),
Quote: quoteStr, Quote: quoteStr,

View file

@ -273,24 +273,24 @@
<b-card-body> <b-card-body>
<p> <p>
Here you can manage your bots auth-token: it's required to communicate with Twitch Chat and APIs. This will override the token you might have provided when starting the bot and will be automatically renewed as long as you don't change your password or revoke the apps permission on your bot account. Here you can manage your bots auth-token: it's required to communicate with Twitch Chat and APIs. The access will be valid as long as you don't change the password or revoke the apps permission in your bot account.
</p> </p>
<ul> <ul>
<li>Copy the URL provided below</li> <li>Copy the URL provided below</li>
<li>Open an inkognito tab or different browser you are not logged into Twitch or are logged in with your bot account</li> <li><strong>Open an inkognito tab or different browser you are not logged into Twitch or are logged in with your bot account</strong></li>
<li>Open the copied URL, sign in with the bot account and accept the permissions</li> <li>Open the copied URL, sign in with the bot account and accept the permissions</li>
<li>The bot will display a message containing the authorized account. If this account is wrong, just start over, the token will be overwritten.</li> <li>You will see a message containing the authorized account. If this account is wrong, just start over, the token will be overwritten.</li>
</ul> </ul>
<p <p
v-if="botMissingScopes > 0" v-if="botMissingScopes > 0"
class="text-warning" class="alert alert-warning"
> >
<font-awesome-icon <font-awesome-icon
fixed-width fixed-width
class="mr-1" class="mr-1"
:icon="['fas', 'exclamation-triangle']" :icon="['fas', 'exclamation-triangle']"
/> />
Bot is missing {{ botMissingScopes }} of its default scopes, please re-authorize the bot. Bot is missing {{ botMissingScopes }} of its required scopes which will cause features not to work properly. Please re-authorize the bot using the URL below.
</p> </p>
<b-input-group> <b-input-group>
<b-form-input <b-form-input