mirror of https://github.com/stijndcl/didier
251 lines
4.3 KiB
Python
251 lines
4.3 KiB
Python
from discord import app_commands
|
|
|
|
__all__ = ["autocomplete_country"]
|
|
|
|
# This list was parsed out of a request to https://disease.sh/v3/covid-19/countries
|
|
country_list = [
|
|
"Afghanistan",
|
|
"Albania",
|
|
"Algeria",
|
|
"Andorra",
|
|
"Angola",
|
|
"Anguilla",
|
|
"Antigua and Barbuda",
|
|
"Argentina",
|
|
"Armenia",
|
|
"Aruba",
|
|
"Australia",
|
|
"Austria",
|
|
"Azerbaijan",
|
|
"Bahamas",
|
|
"Bahrain",
|
|
"Bangladesh",
|
|
"Barbados",
|
|
"Belarus",
|
|
"Belgium",
|
|
"Belize",
|
|
"Benin",
|
|
"Bermuda",
|
|
"Bhutan",
|
|
"Bolivia",
|
|
"Bosnia",
|
|
"Botswana",
|
|
"Brazil",
|
|
"British Virgin Islands",
|
|
"Brunei",
|
|
"Bulgaria",
|
|
"Burkina Faso",
|
|
"Burundi",
|
|
"Cabo Verde",
|
|
"Cambodia",
|
|
"Cameroon",
|
|
"Canada",
|
|
"Caribbean Netherlands",
|
|
"Cayman Islands",
|
|
"Central African Republic",
|
|
"Chad",
|
|
"Channel Islands",
|
|
"Chile",
|
|
"China",
|
|
"Colombia",
|
|
"Comoros",
|
|
"Congo",
|
|
"Cook Islands",
|
|
"Costa Rica",
|
|
"Croatia",
|
|
"Cuba",
|
|
"Curaçao",
|
|
"Cyprus",
|
|
"Czechia",
|
|
"Côte d'Ivoire",
|
|
"DRC",
|
|
"Denmark",
|
|
"Diamond Princess",
|
|
"Djibouti",
|
|
"Dominica",
|
|
"Dominican Republic",
|
|
"Ecuador",
|
|
"Egypt",
|
|
"El Salvador",
|
|
"Equatorial Guinea",
|
|
"Eritrea",
|
|
"Estonia",
|
|
"Ethiopia",
|
|
"Falkland Islands (Malvinas)",
|
|
"Faroe Islands",
|
|
"Fiji",
|
|
"Finland",
|
|
"France",
|
|
"French Guiana",
|
|
"French Polynesia",
|
|
"Gabon",
|
|
"Gambia",
|
|
"Georgia",
|
|
"Germany",
|
|
"Ghana",
|
|
"Gibraltar",
|
|
"Greece",
|
|
"Greenland",
|
|
"Grenada",
|
|
"Guadeloupe",
|
|
"Guatemala",
|
|
"Guinea",
|
|
"Guinea-Bissau",
|
|
"Guyana",
|
|
"Haiti",
|
|
"Holy See (Vatican City State)",
|
|
"Honduras",
|
|
"Hong Kong",
|
|
"Hungary",
|
|
"Iceland",
|
|
"India",
|
|
"Indonesia",
|
|
"Iran",
|
|
"Iraq",
|
|
"Ireland",
|
|
"Isle of Man",
|
|
"Israel",
|
|
"Italy",
|
|
"Jamaica",
|
|
"Japan",
|
|
"Jordan",
|
|
"Kazakhstan",
|
|
"Kenya",
|
|
"Kiribati",
|
|
"Kuwait",
|
|
"Kyrgyzstan",
|
|
"Lao People's Democratic Republic",
|
|
"Latvia",
|
|
"Lebanon",
|
|
"Lesotho",
|
|
"Liberia",
|
|
"Libyan Arab Jamahiriya",
|
|
"Liechtenstein",
|
|
"Lithuania",
|
|
"Luxembourg",
|
|
"MS Zaandam",
|
|
"Macao",
|
|
"Macedonia",
|
|
"Madagascar",
|
|
"Malawi",
|
|
"Malaysia",
|
|
"Maldives",
|
|
"Mali",
|
|
"Malta",
|
|
"Marshall Islands",
|
|
"Martinique",
|
|
"Mauritania",
|
|
"Mauritius",
|
|
"Mayotte",
|
|
"Mexico",
|
|
"Micronesia",
|
|
"Moldova",
|
|
"Monaco",
|
|
"Mongolia",
|
|
"Montenegro",
|
|
"Montserrat",
|
|
"Morocco",
|
|
"Mozambique",
|
|
"Myanmar",
|
|
"N. Korea",
|
|
"Namibia",
|
|
"Nauru",
|
|
"Nepal",
|
|
"Netherlands",
|
|
"New Caledonia",
|
|
"New Zealand",
|
|
"Nicaragua",
|
|
"Niger",
|
|
"Nigeria",
|
|
"Niue",
|
|
"Norway",
|
|
"Oman",
|
|
"Pakistan",
|
|
"Palau",
|
|
"Palestine",
|
|
"Panama",
|
|
"Papua New Guinea",
|
|
"Paraguay",
|
|
"Peru",
|
|
"Philippines",
|
|
"Poland",
|
|
"Portugal",
|
|
"Qatar",
|
|
"Romania",
|
|
"Russia",
|
|
"Rwanda",
|
|
"Réunion",
|
|
"S. Korea",
|
|
"Saint Helena",
|
|
"Saint Kitts and Nevis",
|
|
"Saint Lucia",
|
|
"Saint Martin",
|
|
"Saint Pierre Miquelon",
|
|
"Saint Vincent and the Grenadines",
|
|
"Samoa",
|
|
"San Marino",
|
|
"Sao Tome and Principe",
|
|
"Saudi Arabia",
|
|
"Senegal",
|
|
"Serbia",
|
|
"Seychelles",
|
|
"Sierra Leone",
|
|
"Singapore",
|
|
"Sint Maarten",
|
|
"Slovakia",
|
|
"Slovenia",
|
|
"Solomon Islands",
|
|
"Somalia",
|
|
"South Africa",
|
|
"South Sudan",
|
|
"Spain",
|
|
"Sri Lanka",
|
|
"St. Barth",
|
|
"Sudan",
|
|
"Suriname",
|
|
"Swaziland",
|
|
"Sweden",
|
|
"Switzerland",
|
|
"Syrian Arab Republic",
|
|
"Taiwan",
|
|
"Tajikistan",
|
|
"Tanzania",
|
|
"Thailand",
|
|
"Timor-Leste",
|
|
"Togo",
|
|
"Tonga",
|
|
"Trinidad and Tobago",
|
|
"Tunisia",
|
|
"Turkey",
|
|
"Turks and Caicos Islands",
|
|
"Tuvalu",
|
|
"UAE",
|
|
"UK",
|
|
"USA",
|
|
"Uganda",
|
|
"Ukraine",
|
|
"Uruguay",
|
|
"Uzbekistan",
|
|
"Vanuatu",
|
|
"Venezuela",
|
|
"Vietnam",
|
|
"Wallis and Futuna",
|
|
"Western Sahara",
|
|
"Yemen",
|
|
"Zambia",
|
|
"Zimbabwe",
|
|
]
|
|
|
|
|
|
def autocomplete_country(argument: str) -> list[app_commands.Choice]:
|
|
"""Autocompletion for country names"""
|
|
argument = argument.lower()
|
|
|
|
global_autocomplete = ["Global"]
|
|
|
|
return [
|
|
app_commands.Choice(name=country, value=country)
|
|
for country in global_autocomplete + country_list
|
|
if argument in country.lower()
|
|
]
|