Skip to content

Commit

Permalink
Fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Beniamiiin committed Nov 30, 2023
1 parent 9a375b8 commit ef93c65
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 16 deletions.
1 change: 0 additions & 1 deletion .github/workflows/docker.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@ jobs:
TELEGRAM_AUTHORIZATION_BOT_TOKEN=${{ secrets.TELEGRAM_AUTHORIZATION_BOT_TOKEN }}
DISCORD_AUTHORIZATION_BOT_TOKEN=${{ secrets.DISCORD_AUTHORIZATION_BOT_TOKEN }}
DISCORD_SERVER_ID=${{ secrets.DISCORD_SERVER_ID }}
DISCORD_GUEST_ROLE_ID=${{ secrets.DISCORD_GUEST_ROLE_ID }}
DISCORD_MEMBER_ROLE_ID=${{ secrets.DISCORD_MEMBER_ROLE_ID }}
push: true
tags: ghcr.io/beniamiiin/access-governance-system:tab
Expand Down
3 changes: 1 addition & 2 deletions configs/discord.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package configs

type Discord struct {
Token string `env:"DISCORD_AUTHORIZATION_BOT_TOKEN"`
ChannelID string `env:"DISCORD_SERVER_ID"`
GuestRoleID string `env:"DISCORD_GUEST_ROLE_ID"`
ServerID string `env:"DISCORD_SERVER_ID"`
MemberRoleID string `env:"DISCORD_MEMBER_ROLE_ID"`
}
15 changes: 2 additions & 13 deletions internal/tg_bot/commands/authorization_bot/start.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,11 @@ func (c *startCommand) Handle(text, discordID string, user *models.User, chatID
}
}

err := c.discord.GuildMemberRoleAdd(c.config.ChannelID, discordID, c.config.MemberRoleID)
err := c.discord.GuildMemberRoleAdd(c.config.ServerID, discordID, c.config.MemberRoleID)
if err != nil {
c.logger.Errorw(
"failed to add a role",
"channel_id", c.config.ChannelID,
"server_id", c.config.ServerID,
"discord_id", discordID,
"role_id", c.config.MemberRoleID,
"error", err,
Expand All @@ -71,17 +71,6 @@ func (c *startCommand) Handle(text, discordID string, user *models.User, chatID
return []tgbotapi.Chattable{extension.DefaultErrorMessage(chatID)}
}

err = c.discord.GuildMemberRoleRemove(c.config.ChannelID, discordID, c.config.GuestRoleID)
if err != nil {
c.logger.Warnw(
"failed to remove a role",
"channel_id", c.config.ChannelID,
"discord_id", discordID,
"role_id", c.config.GuestRoleID,
"error", err,
)
}

message := tgbotapi.NewMessage(chatID, "Привет, ты успешно авторизован, можешь возвращаться в Discord")
return []tgbotapi.Chattable{message}
}

0 comments on commit ef93c65

Please sign in to comment.