Esempio n. 1
0
            public async Task SetLeaderboardModule()
            {
                try
                {
                    if (!Privileg.CheckById(Context.User.Id, Privileg.moderator))
                    {
                        await Context.Channel.SendMessageAsync(embed : Classes.Embed.New(Context.Message.Author, Field.CreateFieldBuilder("warning", "You need to be at least moderator to use this command!"), Colors.warning));

                        Log.Warning($"command - set leaderboard - user:{Context.User.Id} channel:{Context.Channel.Id} privileg to low");
                        return;
                    }

                    Log.Information($"command - set leaderboard - start user:{Context.User.Id} channel:{Context.Channel.Id} command:{Context.Message.Content}");

                    var channel_event_list = Channel_Event.GetAllByChannelIdAndType(Context.Channel.Id, 'r');

                    if (channel_event_list != null)
                    {
                        foreach (var channel_event in channel_event_list)
                        {
                            Channel_Event.DeleteById(channel_event.id);
                        }
                    }

                    var message = await Context.Channel.SendMessageAsync(embed : Classes.Embed.GetLeaderboard());

                    Channel_Event.Add(new Channel_Event(1, Context.Channel.Id, 15, $"{message.Id}", 'r'));
                }
                catch (Exception ex)
                {
                    Log.Error($"command - set leaderboard - user:{Context.User.Id} channel:{Context.Channel.Id} error:{ex.Message}");
                }
            }
Esempio n. 2
0
                public async Task DeleteModule(ulong id)
                {
                    try
                    {
                        if (!Privileg.CheckById(Context.User.Id, Privileg.owner))
                        {
                            await Context.Channel.SendMessageAsync(embed : Classes.Embed.New(Context.Message.Author, Field.CreateFieldBuilder("warning", "You are not my god!"), Colors.warning));

                            Log.Warning($"command - data channel_event delete - user:{Context.User.Id} channel:{Context.Channel.Id} privileg to low");
                            return;
                        }

                        Log.Information($"command - data channel_event delete - start user:{Context.User.Id} channel:{Context.Channel.Id} command:{Context.Message.Content}");

                        try
                        {
                            await Context.Channel.SendMessageAsync(embed : Classes.Embed.New(Context.Message.Author, Field.CreateFieldBuilder("channel_event", $"rows affected: {Channel_Event.DeleteById(id)}"), Colors.information));
                        }
                        catch (Exception e)
                        {
                            await Context.Channel.SendMessageAsync(embed : Classes.Embed.New(Context.Message.Author, Field.CreateFieldBuilder("error", e.Message), Colors.error));

                            throw e;
                        }
                    }
                    catch (Exception ex)
                    {
                        Log.Error($"command - data channel_event delete - user:{Context.User.Id} channel:{Context.Channel.Id} error:{ex.Message}");
                    }
                }