Ejemplo n.º 1
0
        private async Task OnDiscordChannelCreated(ChannelCreateEventArgs e)
        {
            Console.WriteLine($"[Discord] Channel created signal received! (guild: {e.Guild.Id}, channel: {e.Channel.Id})", Color.DodgerBlue);


            await PerformSnapshot(e.Guild);
        }
Ejemplo n.º 2
0
 private async Task OnChannelCreated(ChannelCreateEventArgs e)
 {
     if (ChannelCreated != null)
     {
         await ChannelCreated(e);
     }
 }
Ejemplo n.º 3
0
 private async Task ChannelCreated(DiscordClient c, ChannelCreateEventArgs e)
 {
     Task.Run(async() =>
     {
         await logService.GuildLogger(c, e.Guild, e, LogType.Guild).ConfigureAwait(true);
         this.logger.Information($"Channel '{e.Channel.Name}' ({e.Channel.Id}) has been created on guild '{e.Guild.Name}' ({e.Guild.Id}).");
     });
 }
Ejemplo n.º 4
0
        public static async Task ChannelCreated(ChannelCreateEventArgs e, DiscordClient client)
        {
            var log = await client.Guilds.FirstOrDefault().Value.GetAuditLogsAsync(1, null, AuditLogActionType.ChannelCreate);

            if (!log.FirstOrDefault().UserResponsible.IsBot)
            {
                await client.SendMessageAsync(e.Guild.Channels.Where(x => x.Name == "general").FirstOrDefault(), "Nocsak! Új " +
                                              "kommunikációs csatorna " + e.Channel.Name + " néven!");
            }
        }
Ejemplo n.º 5
0
        public static void ChannelPermissions(DiscordClient discordClient, ChannelCreateEventArgs channelCreateEventArgs)
        {
            if (channelCreateEventArgs.Guild == null)
            {
                return;
            }

            using IServiceScope scope = Program.ServiceProvider.CreateScope();
            Database    database    = scope.ServiceProvider.GetService <Database>();
            GuildConfig guildConfig = database.GuildConfigs.First(databaseGuildConfig => databaseGuildConfig.Id == channelCreateEventArgs.Guild.Id);
        }
Ejemplo n.º 6
0
        public static async Task NewChannelCreated(DiscordClient _, ChannelCreateEventArgs c)
        {
            var data = new Global().GetDBRecords(c.Guild.Id);

            var channelId = Convert.ToUInt64(data.LogChannel);

            var channelCreatedEmbed = new DiscordEmbedBuilder()
                                      .WithColor(DiscordColor.Azure)
                                      .WithDescription($"New Channel: {c.Channel.Mention} Has been **created**!");
            await c.Guild.GetChannel(channelId).SendMessageAsync(embed: channelCreatedEmbed);
        }
Ejemplo n.º 7
0
        private Task DiscordClient_ChannelCreated(ChannelCreateEventArgs e)
        {
            var channel = e.Channel;

            if (channel.Type == ChannelType.Text && channel.Name.Contains("broad"))
            {
                lock (channels)
                    channels.Add(channel);
            }
            return(Task.CompletedTask);
        }
Ejemplo n.º 8
0
        private async Task ChannelCreated(DiscordClient sender, ChannelCreateEventArgs e)
        {
            var ccEntry = await GetNewEntryAsync() as DiscordAuditLogChannelEntry;

            string commonType = ccEntry.Target.Type.ToRusCommon();
            string type       = ccEntry.Target.Type == ChannelType.Category ? "" : $", тип канала: {ccEntry.Target.Type.ToRusString()}";

            _entryBuilder = EmbedBuilderExtensions.CreateForAudit(ccEntry, $"Создание {commonType}");
            _entryBuilder.SetDescription($"Создание {commonType} {ccEntry.NameChange.After} {type}");
            await SendMessageToAuditAsync(embed : _entryBuilder);
        }
Ejemplo n.º 9
0
        public static async Task ChannelCreateEventHandlerAsync(FreudShard shard, ChannelCreateEventArgs e)
        {
            var logchn = shard.SharedData.GetLogChannelForGuild(shard.Client, e.Guild);

            if (logchn is null)
            {
                return;
            }

            var emb   = FormEmbedBuilder(EventOrigin.Channel, "Channel created", e.Channel.ToString());
            var entry = await e.Guild.GetLatestAuditLogEntryAsync(AuditLogActionType.ChannelCreate);

            if (entry is null || !(entry is DiscordAuditLogChannelEntry centry))
            {
                emb.AddField("Error", "Failed to read audit log information. Please check my permissions");
            }
Ejemplo n.º 10
0
 private Task ChannelCreated(ChannelCreateEventArgs e)
 {
     /* This would kill my bot */
     return(Task.CompletedTask);
 }
Ejemplo n.º 11
0
 private Task Client_ChannelCreated(DiscordClient client, ChannelCreateEventArgs args)
 {
     return(_eventHandler.Handle(args));
 }
Ejemplo n.º 12
0
 private Task Client_ChannelCreated(ChannelCreateEventArgs e)
 {
     e.Client.DebugLogger.LogMessage(LogLevel.Info, "BotApp", $"{e.Channel.Name} created in {e.Guild.Name}",
                                     DateTime.Now);
     return(Task.CompletedTask);
 }
Ejemplo n.º 13
0
 private Task Event_ChannelCreated(DiscordClient d, ChannelCreateEventArgs e)
 {
     d.Logger.LogDebug(BotEventId, $"{e.Channel.Name} was created on {e.Guild.Name}. Type: {e.Channel.Type}");
     return(Task.CompletedTask);
 }
Ejemplo n.º 14
0
        public static async Task ChannelCreateEventHandlerAsync(TheGodfatherShard shard, ChannelCreateEventArgs e)
        {
            DiscordChannel logchn = shard.SharedData.GetLogChannelForGuild(shard.Client, e.Guild);

            if (logchn == null)
            {
                return;
            }

            DiscordEmbedBuilder emb = FormEmbedBuilder(EventOrigin.Channel, "Channel created", e.Channel.ToString());

            var entry = await e.Guild.GetFirstAuditLogEntryAsync(AuditLogActionType.ChannelCreate);

            if (entry == null || !(entry is DiscordAuditLogChannelEntry centry))
            {
                emb.AddField("Error", "Failed to read audit log information. Please check my permissions");
            }
            else
            {
                emb.AddField("User responsible", centry.UserResponsible?.Mention ?? _unknown, inline: true);
                emb.AddField("Channel type", centry.Target.Type.ToString(), inline: true);
                if (!string.IsNullOrWhiteSpace(centry.Reason))
                {
                    emb.AddField("Reason", centry.Reason);
                }
                emb.WithFooter(centry.CreationTimestamp.ToUtcTimestamp(), centry.UserResponsible.AvatarUrl);
            }

            await logchn.SendMessageAsync(embed : emb.Build());
        }
Ejemplo n.º 15
0
        private static async Task ChannelCreate(BaseDiscordClient client, Embed embed, ChannelCreateEventArgs channelCreateEventArgs)
        {
            embed.Title = $"{DiscordEmoji.FromGuildEmote(client, EmojiLibrary.New)} {channelCreateEventArgs.Channel.Type.ToString()} channel created";
            var description = new StringBuilder()
                              .AppendLine($"{Formatter.InlineCode(channelCreateEventArgs.Channel.Name)} {channelCreateEventArgs.Channel.Mention}");

            if (string.IsNullOrWhiteSpace(channelCreateEventArgs.Channel.Topic))
            {
                description.AppendLine($"Topic: {channelCreateEventArgs.Channel.Topic}");
            }

            description.AppendLine($"Identity: {Formatter.InlineCode(channelCreateEventArgs.Channel.Id.ToString())}")
            .AppendLine($"Parent: {Formatter.InlineCode(channelCreateEventArgs.Channel.Parent.Name)}")
            .AppendLine($"NSFW: {Formatter.InlineCode(channelCreateEventArgs.Channel.IsNSFW.ToString())}");

            if (channelCreateEventArgs.Channel.Type == ChannelType.Voice)
            {
                description.AppendLine($"Bitrate: {Formatter.InlineCode(channelCreateEventArgs.Channel.Bitrate.ToString())}")
                .AppendLine($"User Limit: {Formatter.InlineCode(channelCreateEventArgs.Channel.UserLimitToString())}");
            }

            if (channelCreateEventArgs.Channel.Type == ChannelType.Text)
            {
                description.AppendLine($"Slowmode: {Formatter.InlineCode(channelCreateEventArgs.Channel.PerUserRateLimitToString())}");
            }

            embed.Description = description.ToString();
            embed.Color       = DiscordColor.SpringGreen;
        }