Comments (7)
public enum DiscordCountry : int
{
Unknown = 0,
UnitedStates = 1,
Canada = 2,
UnitedKingdom = 3,
Australia = 4,
Germany = 5,
France = 6,
Brazil = 7,
Mexico = 8,
Netherlands = 9,
Sweden = 10,
Norway = 11,
Denmark = 12,
Finland = 13,
Spain = 14,
Italy = 15,
Poland = 16,
Russia = 17,
Japan = 18,
SouthKorea = 19,
China = 20,
India = 21,
Turkey = 22,
Indonesia = 23,
Philippines = 24
}
from honeycomb.
public static class DiscordCountryExtensions
{
public static string GetFlaggedCountryName(this DiscordCountry country)
{
string countryCode = country.ToString().ToLower();
// Convert country code to flag emoji
countryCode = countryCode.Replace("unitedstates", "us");
countryCode = countryCode.Replace("unitedkingdom", "gb");
countryCode = countryCode.Replace("southkorea", "kr");
countryCode = countryCode.Replace("philippines", "flag-ph");
countryCode = countryCode.Replace("netherlands", "flag-nl");
countryCode = countryCode.Replace("denmark", "flag-dk");
countryCode = countryCode.Replace("finland", "flag-fi");
countryCode = countryCode.Replace(" ", "-");
countryCode = countryCode.Replace("é", "e");
countryCode = $":flag-{countryCode}:";
string countryName = country.ToString();
// Capitalize first letter of each word
TextInfo textInfo = new CultureInfo("en-US", false).TextInfo;
countryName = textInfo.ToTitleCase(countryName.ToLower().Replace("_", " "));
return $"{countryCode} {countryName}";
}
}
from honeycomb.
public enum CountryLanguage : int
{
Unknown = 0,
English = 1, // United States, Canada, United Kingdom, Australia
German = 2, // Germany
French = 3, // France
Portuguese = 4, // Brazil
Spanish = 5, // Mexico, Spain
Dutch = 6, // Netherlands
Swedish = 7, // Sweden
Norwegian = 8, // Norway
Danish = 9, // Denmark
Finnish = 10, // Finland
Polish = 11, // Poland
Russian = 12, // Russia
Japanese = 13, // Japan
Korean = 14, // South Korea
Chinese = 15, // China
Hindi = 16, // India
Turkish = 17, // Turkey
Indonesian = 18, // Indonesia
Filipino_Tagalog = 19 // Philippines
}
from honeycomb.
public static class CountryLanguageExtensions
{
public static string GetFlaggedLanguageName(this CountryLanguage language)
{
string languageCode = language.ToString().ToLower();
// Convert language code to flag emoji
switch (language)
{
case CountryLanguage.English:
languageCode = "gb";
break;
case CountryLanguage.German:
languageCode = "de";
break;
case CountryLanguage.French:
languageCode = "fr";
break;
case CountryLanguage.Portuguese:
languageCode = "pt";
break;
case CountryLanguage.Spanish:
languageCode = "es";
break;
case CountryLanguage.Dutch:
languageCode = "nl";
break;
case CountryLanguage.Swedish:
languageCode = "se";
break;
case CountryLanguage.Norwegian:
languageCode = "no";
break;
case CountryLanguage.Danish:
languageCode = "dk";
break;
case CountryLanguage.Finnish:
languageCode = "fi";
break;
case CountryLanguage.Polish:
languageCode = "pl";
break;
case CountryLanguage.Russian:
languageCode = "ru";
break;
case CountryLanguage.Japanese:
languageCode = "jp";
break;
case CountryLanguage.Korean:
languageCode = "kr";
break;
case CountryLanguage.Chinese:
languageCode = "cn";
break;
case CountryLanguage.Hindi:
languageCode = "in";
break;
case CountryLanguage.Turkish:
languageCode = "tr";
break;
case CountryLanguage.Indonesian:
languageCode = "id";
break;
case CountryLanguage.Filipino_Tagalog:
languageCode = "ph";
break;
default:
return language.ToString();
}
languageCode = $":flag-{languageCode}:";
string languageName = language.ToString();
// Capitalize first letter of each word
TextInfo textInfo = new CultureInfo("en-US", false).TextInfo;
languageName = textInfo.ToTitleCase(languageName.ToLower().Replace("_", " "));
return $"{languageCode} {languageName}";
}
}
from honeycomb.
public enum Timezone
{
Unknown = 0,
InternationalDateLineWest = -720,
Samoa = -660,
Hawaii = -600,
Alaska = -540,
Pacific = -480,
Mountain = -420,
Central = -360,
Eastern = -300,
Atlantic = -240,
Newfoundland = -210,
Brazilia = -180,
MidAtlantic = -120,
Azores = -60,
GMT = 0,
CentralEuropean = 60,
EasternEuropean = 120,
Moscow = 180,
Gulf = 240,
Pakistan = 300,
India = 330,
Nepal = 345,
Bangladesh = 360,
Myanmar = 390,
Indochina = 420,
China = 480,
Korea = 540,
Japan = 540,
AustraliaEastern = 600,
AustraliaCentral = 570,
AustraliaWestern = 480,
PacificIslands = 660,
NewZealand = 720
}
from honeycomb.
public static class TimezoneExtensions
{
public static string GetFlaggedTimezoneName(this Timezone timezone)
{
string timezoneCode = timezone.ToString().Replace("_", " ");
if (timezone == Timezone.Unknown)
{
return "Unknown";
}
string timezoneEmoji = $":flag-{timezone.ToString().ToLower()}:";
string timezoneName = timezoneCode;
// Capitalize first letter of each word
TextInfo textInfo = new CultureInfo("en-US", false).TextInfo;
timezoneName = textInfo.ToTitleCase(timezoneName.ToLower());
return $"{timezoneEmoji} {timezoneName}";
}
}
from honeycomb.
public static class DateTimeExtensions
{
public static DateTime ToTimezone(this DateTime dateTime, Timezone timezone)
{
int minutesToAdjust = (int)timezone;
TimeSpan timeSpan = new TimeSpan(0, minutesToAdjust, 0);
return dateTime + timeSpan;
}
public static DateTime ToUtcFromTimezone(this DateTime dateTime, Timezone timezone)
{
int minutesToAdjust = (int)timezone;
TimeSpan timeSpan = new TimeSpan(0, -minutesToAdjust, 0);
return dateTime + timeSpan;
}
}
from honeycomb.
Related Issues (20)
- Add role check for guild moderators
- Add check if there are more than 25 enum values and create a pagination list
- Add check if there are more than 25 roles in the guild and create a pagination l...
- Discord's new Unique Usernames HOT 1
- Add options with current votes HOT 1
- ComponentInteraction with RegEx in ID doesn't get handled HOT 2
- Move the records as classes to their own files, as LiteDB doesn't support record... HOT 1
- Exclude certain channels from activity tracking
- Return a Top-List for the servers Activity points
- CI Build is broken
- Add command to only show the users activity graph
- Azure Deployment fails
- Birthday in the user profile is shown differently depending on the timezone
- Fix 'Trailing spaces' issue in .github\workflows\main_projecthoneycomb.yml
- Fix 'Unexpected duplicate "background" (declaration-block-no-duplicate-properties)' issue in docs\assets\css\style.css
- Fix 'Complex Method' issue in BaseBotService\Infrastructure\Services\EasterEventService.cs
- Fix 'Complex Method' issue in BaseBotService\Utilities\Extensions\LanguageExtensions.cs
- Fix 'Trailing spaces' issue in .github\workflows\ci.yml
- Fix 'Complex Method' issue in BaseBotService\Utilities\GenerateDocumentation.cs
- More than one moderator role should be configurable HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from honeycomb.