Code2Gether-Discord / Code2Gether-Discord-Bot

A Discord bot for the Code2Gether server
3 stars 1 forks source link

[BUG] When a new channel is created its spawned without a category #58

Closed chrisK00 closed 3 years ago

chrisK00 commented 3 years ago

Describe the bug When a new project channel gets created, the channel is spawned alone anywhere on the server without a category. The problem is that when it looks if the category exists, the search needs to be case insensitive

To Reproduce Steps to reproduce the behavior:

  1. c!create a new project
  2. have another person join the project
  3. look for the channel
  4. check the category name

Expected behavior The channel is spawned inside the [projects] category

Additional information The problem is coming from the TransitionToActiveProject method - .contains

nickmartin1ee7 commented 3 years ago

Auger Today at 10:15 AM https://stackoverflow.com/questions/444798/case-insensitive-containsstring Stack Overflow Case insensitive 'Contains(string)' Is there a way to make the following return true?

string title = "ASTRINGTOTEST"; title.Contains("string"); There doesn't seem to be an overload that allows me to set the case sensitivity.. Curre...

Looks like I'll need an extension method public static class Extensions { public static bool CaseInsensitiveContains(this string text, string value, StringComparison stringComparison = StringComparison.CurrentCultureIgnoreCase) { return text.IndexOf(value, stringComparison) >= 0; } }

ChrisK Today at 10:17 AM what about this? "Test".Contains("test", System.StringComparison.CurrentCultureIgnoreCase);