Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

기능 추가 요청 : Contains() #1

Closed
SeolMJ opened this issue Nov 25, 2021 · 2 comments
Closed

기능 추가 요청 : Contains() #1

SeolMJ opened this issue Nov 25, 2021 · 2 comments
Labels
new feature New feature or request

Comments

@SeolMJ
Copy link

SeolMJ commented Nov 25, 2021

        public bool Contains(string cmd)
        => Contains(cmd, null);

        internal bool Contains(string command, string[] args)
        {
            MethodInfo method = null;
            CommandModule module = null;
            
            for (int i = 0; i < _commands.Count; i++)
            {
                bool igncase = Configuration.IgnoreCase;
                
                IEnumerable<MethodInfo> infos = _commands[i]
                            .GetType().GetMethods(FLAGS)
                            .Where(l => l.GetCustomAttributes().FirstOrDefault(l => l is CommandAttribute) != null);
                
                MethodInfo info = infos
                                    .FirstOrDefault(l => {
                                        CommandAttribute cmdat = l.GetCustomAttribute<CommandAttribute>();
                                        if (!Configuration.GetPrivateMethod && cmdat.IsPrivate)
                                            return false;
                                        
                                        return new string[] { cmdat.Name ?? l.Name }.Concat(cmdat.Alias ?? Array.Empty<string>())
                                                    .Select(l => igncase ? l.ToLower() : l)
                                                    .Contains(igncase ? command.ToLower() : command);
                                    });
                                
                if (info == null) continue;
                
                method = info;
                module = _commands[i];
                
                break;
            }

            return method != null && module != null;
        }

정상 작동 확인했습니다

@qluana7
Copy link
Owner

qluana7 commented Nov 25, 2021

This feature: "providing registered command array" is already in queue.
Check README.md.

해당 기능: "등록된 커맨드 배열 제공"은 진행중에 있습니다.
README.md를 참고하주세요

@qluana7 qluana7 added the new feature New feature or request label Nov 25, 2021
qluana7 added a commit that referenced this issue Nov 25, 2021
#1
Add details
@SeolMJ SeolMJ changed the title 기능 추가 요청 : ContainsCommand() 기능 추가 요청 : Contains() Nov 25, 2021
qluana7 referenced this issue Dec 24, 2021
new event
new property
new method
@qluana7
Copy link
Owner

qluana7 commented Dec 24, 2021

Now add feature. See 1.2.0

@qluana7 qluana7 closed this as completed Dec 24, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
new feature New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants