Example #1
0
                public async Task TimerDayModule()
                {
                    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 - admin timer day - user:{Context.User.Id} channel:{Context.Channel.Id} privileg to low");
                            return;
                        }

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

                        Repetitive_Timer.Daily_timer_Elapsed(null, null);

                        await Context.Channel.SendMessageAsync(embed : Classes.Embed.New(Context.Message.Author, Field.CreateFieldBuilder("info", "timer day done!"), Colors.information));
                    }
                    catch (Exception ex)
                    {
                        Log.Error($"command - admin timer day - user:{Context.User.Id} channel:{Context.Channel.Id} error:{ex.Message}");
                    }
                }
Example #2
0
                public async Task RestartModule()
                {
                    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 - admin timer restart - user:{Context.User.Id} channel:{Context.Channel.Id} privileg to low");
                            return;
                        }

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

                        Repetitive_Timer.SetUpDailyTimer(new TimeSpan(Convert.ToInt32(Global.GetByName("daily_timer_hour").value), 0, 0));
                        Repetitive_Timer.SetUpHourlyTimer(new TimeSpan(DateTime.Now.Hour + 1, 0, 0));

                        await Context.Channel.SendMessageAsync(embed : Classes.Embed.New(Context.Message.Author, Field.CreateFieldBuilder("info", "restart done!"), Colors.information));
                    }
                    catch (Exception ex)
                    {
                        Log.Error($"command - admin timer restart - user:{Context.User.Id} channel:{Context.Channel.Id} error:{ex.Message}");
                    }
                }