Exemple #1
0
        public async Task HandleCommandAsync(SocketMessage m)
        {
            if (m.Author.ToString() != "Cowboy#2612")
            {
                if (ConsoleCommand.boolMessage)
                {
                    Console.ForegroundColor = ConsoleColor.Yellow;
                    Console.WriteLine("\n[LOGS]   Channel name : " + m.Channel + ",   Author name : " +
                                      m.Author + ",   Message Content : " + m.Content);
                    Console.ForegroundColor = ConsoleColor.Green;
                }
            }

            if (!(m is SocketUserMessage msg))
            {
                return;
            }
            if (msg.Author.IsBot)
            {
                return;
            }
            int argPos = 0;

            var channelll = client.GetChannel(717265650929893376) as SocketGuildChannel;

            if (!(msg.HasStringPrefix("c ", ref argPos)) && !(msg.HasStringPrefix("C ", ref argPos)))
            {
                return;
            }

            if (!File.Exists(@"database\account\" + accName(msg.Author.Id) + ".json") && msg.Content.ToLower().Substring(0, 2) == "c " && !msg.Content.ToLower().Contains("c register") && !msg.Content.ToLower().Contains("c help") && !msg.Content.ToLower().Contains("c login") &&
                !msg.Content.ToLower().Contains("c enableaap") && !msg.Content.ToLower().Contains("c disableaap"))
            {
                await noacc(msg.Author);

                return;
            }

            Steal s = new Steal();

            if (File.Exists(@"database\jailed\" + accName(msg.Author.Id) + ".json"))
            {
                await s.jailTime(accName(msg.Author.Id), msg.Author as IGuildUser);
            }

            if (s.isOnJail(accName(m.Author.Id)) == true)
            {
                return;
            }

            else if (msg.Channel.ToString() == ("@" + msg.Author) && !msg.Content.ToLower()
                     .Contains("c enableaap") && !msg.Content.ToLower().Contains("c disableaap"))
            {
                return;
            }

            var context = new SocketCommandContext(client, msg);
            await commands.ExecuteAsync(context, argPos, services);
        }