Skip to content

Commit

Permalink
Merge pull request #514 from senchabot-opensource/dev
Browse files Browse the repository at this point in the history
dev -> main
  • Loading branch information
senchabot-github committed Sep 15, 2024
2 parents 4066e86 + 7ce984f commit 1534976
Show file tree
Hide file tree
Showing 120 changed files with 2,758 additions and 1,779 deletions.
66 changes: 44 additions & 22 deletions apps/discord-bot/internal/command/deltwitch.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,9 @@ func (c *commands) DelTwitchCommand(ctx context.Context, s *discordgo.Session, i
}

if !ok {
ephemeralRespond(s, i, "`"+twitchUsername+"` kullanıcı adlı Twitch yayıncısı veritabanında bulunamadı.")
// * TR
// ephemeralRespond(s, i, "`"+twitchUsername+"` kullanıcı adlı Twitch yayıncısı veritabanında bulunamadı.")
ephemeralRespond(s, i, "Twitch streamer with username `"+twitchUsername+"` is not found in our database.")
return
}

Expand All @@ -45,7 +47,9 @@ func (c *commands) DelTwitchCommand(ctx context.Context, s *discordgo.Session, i
ephemeralRespond(s, i, "There was a problem when deleting Twitch streamer `"+uInfo.Login+"`")
return
}
ephemeralRespond(s, i, "`"+uInfo.Login+"` kullanıcı adlı Twitch streamer veritabanından silindi.")
// TR
// ephemeralRespond(s, i, "`"+uInfo.Login+"` kullanıcı adlı Twitch streamer veritabanından silindi.")
ephemeralRespond(s, i, "Twitch streamer with username `"+uInfo.Login+"` deleted from the database.")

// del-twitch event-channel
case "event-channel":
Expand All @@ -60,10 +64,14 @@ func (c *commands) DelTwitchCommand(ctx context.Context, s *discordgo.Session, i
return
}
if !ok {
ephemeralRespond(s, i, "`"+channelName+"` isimli yazı kanalı yayın etkinlik yazı kanalları listesinde bulunamadı.")
// TR
// ephemeralRespond(s, i, "`"+channelName+"` isimli yazı kanalı yayın etkinlik yazı kanalları listesinde bulunamadı.")
ephemeralRespond(s, i, "The text channel named `"+channelName+"` was not found in the list of event text channels.")
return
}
ephemeralRespond(s, i, "`"+channelName+"` isimli yazı kanalı yayın etkinlik yazı kanalları listesinden kaldırıldı.")
// TR
// ephemeralRespond(s, i, "`"+channelName+"` isimli yazı kanalı yayın etkinlik yazı kanalları listesinden kaldırıldı.")
ephemeralRespond(s, i, "The text channel named `"+channelName+"` removed from the list of event text channels.")

// del-twitch announcement
case "announcement":
Expand All @@ -78,10 +86,10 @@ func (c *commands) DelTwitchCommand(ctx context.Context, s *discordgo.Session, i
return
}

log.Println("liveAnnosLength", liveAnnosLength)
if liveAnnosLength > 0 {
ephemeralRespond(s, i, "Twitch yayıncısına özgü yayın duyuru kanalı olmayan yayıncılar veritabanında bulunduğu için varsayılan Twitch canlı yayın duyuru kanalı ayarını silemezsiniz.")
// EN: You cannot delete the default channel setting as there are streamers without a custom channel setting
ephemeralRespond(s, i, "You cannot delete the default Twitch live stream announcement channel setting because there are streamers in the database who do not have a custom stream announcement channel set.")
// TR
// Veritabanında özel yayın duyuru kanalı ayarlanmamış yayıncılar bulunduğu için varsayılan Twitch canlı yayın duyuru kanalı ayarını silemezsiniz.
return
}

Expand All @@ -96,18 +104,23 @@ func (c *commands) DelTwitchCommand(ctx context.Context, s *discordgo.Session, i
ephemeralRespond(s, i, config.ErrorMessage+"#0002")
return
}
ephemeralRespond(s, i, "Varsayılan Twitch canlı yayın duyuru kanalı ayarı kaldırıldı.")
// TR
// ephemeralRespond(s, i, "Varsayılan Twitch canlı yayın duyuru kanalı ayarı kaldırıldı.")
ephemeralRespond(s, i, "The default Twitch live stream announcement channel setting removed.")

// del-twitch announcement default-content
case "default-content":
_, err := service.DeleteDiscordBotConfig(ctx, i.GuildID, "stream_anno_default_content")
if err != nil {
log.Println("[command.DelTwitchCommand.announcement.default-content] DeleteDiscordBotConfig error:", err.Error())
// TODO: edit response message
ephemeralRespond(s, i, config.ErrorMessage+"#0001")
return
}

ephemeralRespond(s, i, "Yayın duyuru mesajı içeriği varsayılan olarak ayarlandı: `{stream.user}, {stream.category} yayınına başladı! {stream.url}`")
// TR
// ephemeralRespond(s, i, "Tarafınızdan ayarlanan varsayılan yayın duyuru mesajı içeriği kaldırıldı. Ve varsayılan yayın duyuru mesajı Senchabot varsayılanlarına sıfırlandı: `{twitch.username}, {stream.category} yayınına başladı! {twitch.url}`")
ephemeralRespond(s, i, "Removed the default stream announcement message content set by you. And message content has been reset to Senchabot defaults: `{twitch.username} has started streaming {stream.category}! {twitch.url}`")

// del-twitch announcement custom-content
case "custom-content":
Expand All @@ -129,11 +142,15 @@ func (c *commands) DelTwitchCommand(ctx context.Context, s *discordgo.Session, i
}

if !ok {
// TODO: edit response message
ephemeralRespond(s, i, config.ErrorMessage+"del-twitch:custom-content#0002")
return
}

ephemeralRespond(s, i, twitchUsername+" kullanıcı adlı Twitch yayıncısına özgü yayın duyuru mesajı silindi.")
//TR
// ephemeralRespond(s, i, twitchUsername+" kullanıcı adlı Twitch yayıncısının özel yayın duyuru mesajı silindi.")
ephemeralRespond(s, i, "Twitch streamer `"+twitchUsername+"` 's custom stream announcement message content has been deleted.")

// del-twitch announcement category-filter
case "category-filter":
options = options[0].Options
Expand All @@ -147,10 +164,14 @@ func (c *commands) DelTwitchCommand(ctx context.Context, s *discordgo.Session, i
return
}
if !ok {
ephemeralRespond(s, i, "`"+channelName+"` isimli yazı kanalı Twitch yayın duyurusu kategori filtrelemesi bulunamadı.")
// TR
// ephemeralRespond(s, i, "`"+channelName+"` isimli yazı kanalı için Twitch yayın duyuru kategori filtrelemesi bulunamadı.")
ephemeralRespond(s, i, "For the text channel named `"+channelName+"`, Twitch stream announcement category filtering was not found.")
return
}
ephemeralRespond(s, i, "`"+channelName+"` isimli yazı kanalı Twitch yayın duyurusu kategori filtrelemesi kaldırıldı.")
// TR
// ephemeralRespond(s, i, "`"+channelName+"` isimli yazı kanalı için Twitch yayın duyuru kategori filtrelemesi kaldırıldı.")
ephemeralRespond(s, i, "For the text channel named `"+channelName+"`, Twitch stream announcement category filtering removed.")
}
}
}
Expand All @@ -167,18 +188,19 @@ func DelTwitchCommandMetadata() *discordgo.ApplicationCommand {
// del-twitch streamer
{
Name: "streamer",
Description: "Delete the stream from live stream announcements.",
Description: "Delete streamer from live stream announcements.",
DescriptionLocalizations: map[discordgo.Locale]string{
// TODO: edit
discordgo.Turkish: "Yayın duyuru mesajı atılan yayıncıyı sil.",
},
Type: discordgo.ApplicationCommandOptionSubCommand,
Options: []*discordgo.ApplicationCommandOption{
{
Type: discordgo.ApplicationCommandOptionString,
Name: "twitch-username-or-url",
Description: "Twitch profile url or username",
Description: "Type Twitch profile url or username.",
DescriptionLocalizations: map[discordgo.Locale]string{
discordgo.Turkish: "Twitch kullanıcı profil linki veya kullanıcı adı",
discordgo.Turkish: "Twitch kullanıcı profil linkini veya kullanıcı adını yazınız.",
},
Required: true,
},
Expand Down Expand Up @@ -210,18 +232,18 @@ func DelTwitchCommandMetadata() *discordgo.ApplicationCommand {
// del-twitch announcement custom-content
{
Name: "custom-content",
Description: "Delete the streamer specific custom live stream announcement message content.",
Description: "Delete the streamer custom live stream announcement message content.",
DescriptionLocalizations: map[discordgo.Locale]string{
discordgo.Turkish: "Yayıncıya özgü yayın duyuru mesajını sil.",
discordgo.Turkish: "Yayıncıya özel yayın duyuru mesajını sil.",
},
Type: discordgo.ApplicationCommandOptionSubCommand,
Options: []*discordgo.ApplicationCommandOption{
{
Type: discordgo.ApplicationCommandOptionString,
Name: "twitch-username-or-url",
Description: "Twitch profile url or username",
Description: "Type Twitch profile url or username.",
DescriptionLocalizations: map[discordgo.Locale]string{
discordgo.Turkish: "Twitch kullanıcı profil linki veya kullanıcı adı",
discordgo.Turkish: "Twitch kullanıcı profil linkini veya kullanıcı adını yazınız.",
},
Required: true,
},
Expand Down Expand Up @@ -259,16 +281,16 @@ func DelTwitchCommandMetadata() *discordgo.ApplicationCommand {
Name: "event-channel",
Description: "Delete the live stream announcements channel setting to create Discord events for live streams.",
DescriptionLocalizations: map[discordgo.Locale]string{
discordgo.Turkish: "Canlı yayınların Discord etkinliklerini oluşturmak için canlı yayın duyuruları kanalını seç.",
discordgo.Turkish: "Canlı yayın Discord etkinliklerinin oluşturulduğu duyuru kanalını sil.",
},
Type: discordgo.ApplicationCommandOptionSubCommand,
Options: []*discordgo.ApplicationCommandOption{
{
Type: discordgo.ApplicationCommandOptionChannel,
Name: "channel",
Description: "The text channel where Twitch live stream announcements will be unfollowed",
Description: "Type the text channel where Twitch live stream announcements will be unfollowed",
DescriptionLocalizations: map[discordgo.Locale]string{
discordgo.Turkish: "Twitch yayın duyurularının takipten çıkarılacağı yazı kanalı",
discordgo.Turkish: "Twitch yayın duyurularının takipten çıkarılacağı yazı kanalını yazınız.",
},
ChannelTypes: []discordgo.ChannelType{
discordgo.ChannelTypeGuildNews,
Expand Down
2 changes: 1 addition & 1 deletion apps/discord-bot/internal/command/invite.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@ func (c *commands) InviteCommand(ctx context.Context, s *discordgo.Session, i *d
func InviteCommandMetadata() *discordgo.ApplicationCommand {
return &discordgo.ApplicationCommand{
Name: "invite",
Description: "Senchabot Discord bot invite url.",
Description: "Get Senchabot Discord bot invite url.",
}
}
8 changes: 6 additions & 2 deletions apps/discord-bot/internal/command/purge.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,16 @@ func (c *commands) PurgeCommand(ctx context.Context, s *discordgo.Session, i *di
events, err := s.GuildScheduledEvents(i.GuildID, false)
if err != nil {
log.Println("[command.PurgeCommand.events] GuildScheduledEvents error:", err.Error())
// TODO: edit respond or create errorMessage sheet
ephemeralRespond(s, i, config.ErrorMessage+"#1011")
}

for _, e := range events {
s.GuildScheduledEventDelete(i.GuildID, e.ID)
}

ephemeralRespond(s, i, "Tüm planlanmış etkinlikler silindi.")
// TR
// ephemeralRespond(s, i, "Tüm planlanmış etkinlikler silindi.")
ephemeralRespond(s, i, "All scheduled events have been deleted.")

case "last-100-channel-messages":
options = options[0].Options
Expand All @@ -38,6 +40,8 @@ func (c *commands) PurgeCommand(ctx context.Context, s *discordgo.Session, i *di
return
}

// TODO: "Something went wrong" → // TODO: edit respond + add error code or create errorMessage sheet

optionValue := options[0].StringValue()
channelID := i.ChannelID
var messageIDs []string
Expand Down
Loading

0 comments on commit 1534976

Please sign in to comment.