コード例 #1
0
                public async Task SetModule(ulong id, string name, string what, string how)
                {
                    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 vote set - user:{Context.User.Id} channel:{Context.Channel.Id} privileg to low");
                            return;
                        }

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

                        try
                        {
                            var item = Vote.GetById(id);
                            item.name = name;
                            item.what = what;
                            item.how  = how;
                            await Context.Channel.SendMessageAsync(embed : Classes.Embed.New(Context.Message.Author, Field.CreateFieldBuilder("vote", $"rows affected: {Vote.Edit(item)}"), 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 vote set - user:{Context.User.Id} channel:{Context.Channel.Id} error:{ex.Message}");
                    }
                }