コード例 #1
0
ファイル: flower.cs プロジェクト: n-oxy/MGX-Discord-Bot
        public static async Task Maindo(SocketMessage arg)
        {
            if (Economy.CountProductForUser(Product.flower, arg.Author.Id) > 0)
            {
                var User = arg.MentionedUsers.Count >= 1 ? arg.MentionedUsers.First() : null;
                if (User == null)
                {
                    await arg.Channel.SendMessageAsync("Please mention a user to give the flower to!");

                    var WFR = new WaitForResponse()
                    {
                        TimeLimitS = 15,
                        ChannelId  = arg.Channel.Id,
                        UserId     = arg.Author.Id
                    };
                    var Msg = await WFR.Start();

                    User = Msg.MentionedUsers.Count > 0 ? Msg.MentionedUsers.First() : null;
                }
                await arg.Channel.SendMessageAsync($"You gave {User.Mention} a flower! <3");

                Economy.ChangeProductCountForUser(Product.flower, -1, arg.Author.Id);
                Economy.ChangeProductCountForUser(Product.flower, 1, User.Id);
            }
            else
            {
                await arg.Channel.SendMessageAsync($"You need to buy flowers first! `{Program.Prefix}buy flower`");
            }
        }
コード例 #2
0
ファイル: setup.cs プロジェクト: n-oxy/MGX-Discord-Bot
        private static async Task <bool> SetupX(SocketMessage arg, string Message)
        {
            try
            {
                var WFR = new WaitForResponse()
                {
                    TimeLimitS = 60, ChannelId = arg.Channel.Id, UserId = arg.Author.Id
                };
                await arg.Channel.SendMessageAsync(Message);

                var CusRespReply = await WFR.Start();

                if (CusRespReply != null && CusRespReply.Content.ToLower().Contains("yes"))
                {
                    await CusRespReply.AddReactionAsync(new Emoji("✅"));
                }
                else
                {
                    await CusRespReply.AddReactionAsync(new Emoji("❌"));
                }
                return(CusRespReply == null ? false : CusRespReply.Content.ToLower().Contains("yes"));
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
            return(false);
        }