diff --git a/jarvis/cogs/dbrand.py b/jarvis/cogs/dbrand.py new file mode 100644 index 0000000..8e19f31 --- /dev/null +++ b/jarvis/cogs/dbrand.py @@ -0,0 +1,566 @@ +import jarvis +import re +from jarvis.utils import build_embed +from jarvis.utils.field import Field +from discord.ext import commands + +DBRAND_DATA = { + "shippingArray": [ + "afghanistan", + "aland-islands", + "albania", + "algeria", + "american-samoa", + "andorra", + "angola", + "anguilla", + "antarctica", + "antigua-and-barbuda", + "argentina", + "armenia", + "aruba", + "australia", + "austria", + "azerbaijan", + "bahamas", + "bahrain", + "bangladesh", + "barbados", + "belarus", + "belgium", + "belize", + "benin", + "bermuda", + "bhutan", + "bolivia", + "bosnia-and-herzegovina", + "botswana", + "bouvet-island", + "brazil", + "british-indian-ocean-territory", + "british-virgin-islands", + "brunei", + "bulgaria", + "burkina-faso", + "burundi", + "cambodia", + "cameroon", + "canada", + "cape-verde", + "caribbean-netherlands", + "cayman-islands", + "central-african-republic", + "chad", + "chile", + "china", + "christmas-island", + "cocos-keeling-islands", + "colombia", + "comoros", + "congo-brazzaville", + "congo-kinshasa", + "cook-islands", + "costa-rica", + "croatia", + "cuba", + "cura%C3%A7ao", + "cyprus", + "czech-republic", + "denmark", + "djibouti", + "dominica", + "dominican-republic", + "ecuador", + "egypt", + "el-salvador", + "equatorial-guinea", + "eritrea", + "estonia", + "ethiopia", + "falkland-islands", + "faroe-islands", + "fiji", + "finland", + "france", + "french-guiana", + "french-polynesia", + "french-southern-territories", + "gabon", + "gambia", + "georgia", + "germany", + "ghana", + "gibraltar", + "greece", + "greenland", + "grenada", + "guadeloupe", + "guam", + "guatemala", + "guernsey", + "guinea", + "guinea-bissau", + "guyana", + "haiti", + "heard-island-and-mcdonald-islands", + "honduras", + "hong-kong-sar-china", + "hungary", + "iceland", + "india", + "indonesia", + "iran", + "iraq", + "ireland", + "isle-of-man", + "israel", + "italy", + "ivory-coast", + "jamaica", + "japan", + "jersey", + "jordan", + "kazakhstan", + "kenya", + "kiribati", + "kuwait", + "kyrgyzstan", + "laos", + "latvia", + "lebanon", + "lesotho", + "liberia", + "libya", + "liechtenstein", + "lithuania", + "luxembourg", + "macao-sar-china", + "macedonia", + "madagascar", + "malawi", + "malaysia", + "maldives", + "mali", + "malta", + "marshall-islands", + "martinique", + "mauritania", + "mauritius", + "mayotte", + "mexico", + "micronesia", + "moldova", + "monaco", + "mongolia", + "montenegro", + "montserrat", + "morocco", + "mozambique", + "myanmar", + "namibia", + "nauru", + "nepal", + "netherlands", + "netherlands-antilles", + "new-caledonia", + "new-zealand", + "nicaragua", + "niger", + "nigeria", + "niue", + "norfolk-island", + "northern-mariana-islands", + "north-korea", + "norway", + "oman", + "pakistan", + "palau", + "palestinian-territory", + "panama", + "papua-new-guinea", + "paraguay", + "peru", + "philippines", + "pitcairn", + "poland", + "portugal", + "puerto-rico", + "qatar", + "reunion", + "romania", + "russia", + "rwanda", + "saint-barth%C3%A9lemy", + "saint-helena", + "saint-kitts-and-nevis", + "saint-lucia", + "saint-martin-french-part", + "saint-pierre-and-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-georgia-and-the-south-sandwich-islands", + "south-korea", + "south-sudan", + "spain", + "sri-lanka", + "sudan", + "suriname", + "svalbard-and-jan-mayen", + "swaziland", + "sweden", + "switzerland", + "syria", + "taiwan", + "tajikistan", + "tanzania", + "thailand", + "timor-leste", + "togo", + "tokelau", + "tonga", + "trinidad-and-tobago", + "tunisia", + "turkey", + "turkmenistan", + "turks-and-caicos-islands", + "tuvalu", + "uganda", + "ukraine", + "united-arab-emirates", + "united-kingdom", + "united-states", + "united-states-minor-outlying-islands", + "uruguay", + "us-virgin-islands", + "uzbekistan", + "vanuatu", + "vatican", + "venezuela", + "vietnam", + "wallis-and-futuna", + "western-sahara", + "yemen", + "zambia", + "zimbabwe", + ], + "howtoArray": [ + "https://dbrand.com/how-to-apply/airpower", + "https://dbrand.com/how-to-apply/alienware-13-r3", + "https://dbrand.com/how-to-apply/alienware-15-r3", + "https://dbrand.com/how-to-apply/alienware-17-r4-eye-tracking", + "https://dbrand.com/how-to-apply/alienware-17-r4-no-eye-tracking", + "https://dbrand.com/how-to-apply/alienware-17-r5-eye-tracking", + "https://dbrand.com/how-to-apply/alienware-17-r5-no-eye-tracking", + "https://dbrand.com/how-to-apply/anker-powercore-13000-usb-c", + "https://dbrand.com/how-to-apply/anker-powercore-plus-20100-usb-c", + "https://dbrand.com/how-to-apply/anker-powercore-plus-26800-pd", + "https://dbrand.com/how-to-apply/anker-powercore-slim-10000-pd", + "https://dbrand.com/how-to-apply/apple-18w-usb-c-power-adapter", + "https://dbrand.com/how-to-apply/apple-5w-usb-power-adapter", + "https://dbrand.com/how-to-apply/apple-airpods-gen-1", + "https://dbrand.com/how-to-apply/apple-airpods-gen-2-no-wireless-charging", + "https://dbrand.com/how-to-apply/apple-airpods-gen-2-wireless-charging", + "https://dbrand.com/how-to-apply/apple-airpods-pro", + "https://dbrand.com/how-to-apply/apple-card", + "https://dbrand.com/how-to-apply/apple-pencil", + "https://dbrand.com/how-to-apply/apple-pencil-2", + "https://dbrand.com/how-to-apply/axon-7", + "https://dbrand.com/how-to-apply/blade-14-2014-2016-gtx-970m", + "https://dbrand.com/how-to-apply/blade-14-2016-2017-gtx-1060", + "https://dbrand.com/how-to-apply/blade-stealth-125-early-2016-skylake", + "https://dbrand.com/how-to-apply/blade-stealth-125-late-2016-2017-kaby-lake", + "https://dbrand.com/how-to-apply/blade-stealth-13.3-2017-2018", + "https://dbrand.com/how-to-apply/blade-stealth-13.3-early-2019", + "https://dbrand.com/how-to-apply/blade-stealth-13.3-late-2019", + "https://dbrand.com/how-to-apply/dell-xps-13-2-in-1-7390", + "https://dbrand.com/how-to-apply/dell-xps-13-2-in-1-9365", + "https://dbrand.com/how-to-apply/dell-xps-13-7390", + "https://dbrand.com/how-to-apply/dell-xps-13-9350-9360", + "https://dbrand.com/how-to-apply/dell-xps-15-9550", + "https://dbrand.com/how-to-apply/dell-xps-15-9560", + "https://dbrand.com/how-to-apply/eluktronics-mag-15", + "https://dbrand.com/how-to-apply/essential-phone", + "https://dbrand.com/how-to-apply/eve-v", + "https://dbrand.com/how-to-apply/galaxy-a50", + "https://dbrand.com/how-to-apply/galaxy-a70", + "https://dbrand.com/how-to-apply/galaxy-buds", + "https://dbrand.com/how-to-apply/galaxy-fold", + "https://dbrand.com/how-to-apply/galaxy-note-10", + "https://dbrand.com/how-to-apply/galaxy-note-10-plus", + "https://dbrand.com/how-to-apply/galaxy-note-10-plus-5g", + "https://dbrand.com/how-to-apply/galaxy-note-4", + "https://dbrand.com/how-to-apply/galaxy-note-5", + "https://dbrand.com/how-to-apply/galaxy-note-7", + "https://dbrand.com/how-to-apply/galaxy-note-8", + "https://dbrand.com/how-to-apply/galaxy-note-9", + "https://dbrand.com/how-to-apply/galaxy-note-fe", + "https://dbrand.com/how-to-apply/galaxy-s10", + "https://dbrand.com/how-to-apply/galaxy-s10-5g", + "https://dbrand.com/how-to-apply/galaxy-s10e", + "https://dbrand.com/how-to-apply/galaxy-s10-plus", + "https://dbrand.com/how-to-apply/galaxy-s6", + "https://dbrand.com/how-to-apply/galaxy-s6-active", + "https://dbrand.com/how-to-apply/galaxy-s6-edge", + "https://dbrand.com/how-to-apply/galaxy-s6-edge-plus", + "https://dbrand.com/how-to-apply/galaxy-s7", + "https://dbrand.com/how-to-apply/galaxy-s7-active", + "https://dbrand.com/how-to-apply/galaxy-s7-edge", + "https://dbrand.com/how-to-apply/galaxy-s8", + "https://dbrand.com/how-to-apply/galaxy-s8-active", + "https://dbrand.com/how-to-apply/galaxy-s8-plus", + "https://dbrand.com/how-to-apply/galaxy-s9", + "https://dbrand.com/how-to-apply/galaxy-s9-plus", + "https://dbrand.com/how-to-apply/google-home", + "https://dbrand.com/how-to-apply/honor-8", + "https://dbrand.com/how-to-apply/htc-10", + "https://dbrand.com/how-to-apply/htc-one-m7", + "https://dbrand.com/how-to-apply/htc-one-m8", + "https://dbrand.com/how-to-apply/htc-one-m9", + "https://dbrand.com/how-to-apply/htc-u-ultra", + "https://dbrand.com/how-to-apply/huawei-mate-10", + "https://dbrand.com/how-to-apply/huawei-mate-10-pro", + "https://dbrand.com/how-to-apply/huawei-mate-20", + "https://dbrand.com/how-to-apply/huawei-mate-20-pro", + "https://dbrand.com/how-to-apply/huawei-mate-30-pro", + "https://dbrand.com/how-to-apply/huawei-matebook-x-pro-2018", + "https://dbrand.com/how-to-apply/huawei-matebook-x-pro-2019", + "https://dbrand.com/how-to-apply/huawei-p10", + "https://dbrand.com/how-to-apply/huawei-p10-plus", + "https://dbrand.com/how-to-apply/huawei-p20", + "https://dbrand.com/how-to-apply/huawei-p20-pro", + "https://dbrand.com/how-to-apply/huawei-p30", + "https://dbrand.com/how-to-apply/huawei-p30-pro", + "https://dbrand.com/how-to-apply/huawei-p9", + "https://dbrand.com/how-to-apply/intel-nuc-mainstream-mini-pc", + "https://dbrand.com/how-to-apply/ipad-10.2-2019-gen-7", + "https://dbrand.com/how-to-apply/ipad-9.7-skins-2017-2018", + "https://dbrand.com/how-to-apply/ipad-air-2", + "https://dbrand.com/how-to-apply/ipad-air-3", + "https://dbrand.com/how-to-apply/ipad-mini-4", + "https://dbrand.com/how-to-apply/ipad-mini-5", + "https://dbrand.com/how-to-apply/ipad-pro-105", + "https://dbrand.com/how-to-apply/ipad-pro-11", + "https://dbrand.com/how-to-apply/ipad-pro-12.9-2018-gen-3", + "https://dbrand.com/how-to-apply/ipad-pro-129-2016-gen-1", + "https://dbrand.com/how-to-apply/ipad-pro-129-2017-gen-2", + "https://dbrand.com/how-to-apply/ipad-pro-97-2016", + "https://dbrand.com/how-to-apply/iphone-11", + "https://dbrand.com/how-to-apply/iphone-11-pro", + "https://dbrand.com/how-to-apply/iphone-11-pro-max", + "https://dbrand.com/how-to-apply/iphone-4-4s", + "https://dbrand.com/how-to-apply/iphone-5", + "https://dbrand.com/how-to-apply/iphone-5s", + "https://dbrand.com/how-to-apply/iphone-6", + "https://dbrand.com/how-to-apply/iphone-6-plus", + "https://dbrand.com/how-to-apply/iphone-6s", + "https://dbrand.com/how-to-apply/iphone-6s-plus", + "https://dbrand.com/how-to-apply/iphone-7", + "https://dbrand.com/how-to-apply/iphone-7-plus", + "https://dbrand.com/how-to-apply/iphone-8", + "https://dbrand.com/how-to-apply/iphone-8-plus", + "https://dbrand.com/how-to-apply/iphone-se", + "https://dbrand.com/how-to-apply/iphone-x", + "https://dbrand.com/how-to-apply/iphone-xr", + "https://dbrand.com/how-to-apply/iphone-xs", + "https://dbrand.com/how-to-apply/iphone-xs-max", + "https://dbrand.com/how-to-apply/juul", + "https://dbrand.com/how-to-apply/juul-c1", + "https://dbrand.com/how-to-apply/lenovo-thinkpad-x1-carbon-6th-gen", + "https://dbrand.com/how-to-apply/lenovo-thinkpad-x1-carbon-7th-gen", + "https://dbrand.com/how-to-apply/lg-g3", + "https://dbrand.com/how-to-apply/lg-g4", + "https://dbrand.com/how-to-apply/lg-g5", + "https://dbrand.com/how-to-apply/lg-g6", + "https://dbrand.com/how-to-apply/lg-g7", + "https://dbrand.com/how-to-apply/lg-v20", + "https://dbrand.com/how-to-apply/lg-v30", + "https://dbrand.com/how-to-apply/m40x", + "https://dbrand.com/how-to-apply/m50", + "https://dbrand.com/how-to-apply/m50x", + "https://dbrand.com/how-to-apply/macbook-12-2015-2018-retina", + "https://dbrand.com/how-to-apply/macbook-air-11", + "https://dbrand.com/how-to-apply/macbook-air-13", + "https://dbrand.com/how-to-apply/macbook-air-13-2018-2019", + "https://dbrand.com/how-to-apply/macbook-pro-13-2013-2015-retina", + "https://dbrand.com/how-to-apply/macbook-pro-13-skins-2016-2018-four-thunderbolt", + "https://dbrand.com/how-to-apply/macbook-pro-13-skins-2016-2018-two-thunderbolt", + "https://dbrand.com/how-to-apply/macbook-pro-13-skins-2019-four-thunderbolt", + "https://dbrand.com/how-to-apply/macbook-pro-13-skins-2019-two-thunderbolt", + "https://dbrand.com/how-to-apply/macbook-pro-15-2013-2015-retina", + "https://dbrand.com/how-to-apply/macbook-pro-15-touch-bar", + "https://dbrand.com/how-to-apply/macbook-pro-16-2019", + "https://dbrand.com/how-to-apply/mac-pro-and-pro-display-xdr", + "https://dbrand.com/how-to-apply/maingear-element", + "https://dbrand.com/how-to-apply/moto-g-2013", + "https://dbrand.com/how-to-apply/moto-g-2014", + "https://dbrand.com/how-to-apply/moto-x-2013", + "https://dbrand.com/how-to-apply/moto-x-2014", + "https://dbrand.com/how-to-apply/moto-x4", + "https://dbrand.com/how-to-apply/moto-x-play", + "https://dbrand.com/how-to-apply/moto-x-style-pure", + "https://dbrand.com/how-to-apply/moto-z", + "https://dbrand.com/how-to-apply/moto-z-force", + "https://dbrand.com/how-to-apply/nextbit-robin", + "https://dbrand.com/how-to-apply/nexus-4", + "https://dbrand.com/how-to-apply/nexus-5", + "https://dbrand.com/how-to-apply/nexus-5x", + "https://dbrand.com/how-to-apply/nexus-6", + "https://dbrand.com/how-to-apply/nexus-6p", + "https://dbrand.com/how-to-apply/nexus-7-2012", + "https://dbrand.com/how-to-apply/nexus-7-2013", + "https://dbrand.com/how-to-apply/nexus-9", + "https://dbrand.com/how-to-apply/nintendo-switch", + "https://dbrand.com/how-to-apply/nintendo-switch-lite", + "https://dbrand.com/how-to-apply/nintendo-switch-pro-controller", + "https://dbrand.com/how-to-apply/oneplus-2", + "https://dbrand.com/how-to-apply/oneplus-3", + "https://dbrand.com/how-to-apply/oneplus-3t", + "https://dbrand.com/how-to-apply/oneplus-5", + "https://dbrand.com/how-to-apply/oneplus-5t", + "https://dbrand.com/how-to-apply/oneplus-6", + "https://dbrand.com/how-to-apply/oneplus-6t", + "https://dbrand.com/how-to-apply/oneplus-7", + "https://dbrand.com/how-to-apply/oneplus-7-pro", + "https://dbrand.com/how-to-apply/oneplus-7t", + "https://dbrand.com/how-to-apply/oneplus-7t-pro", + "https://dbrand.com/how-to-apply/oneplus-one", + "https://dbrand.com/how-to-apply/oneplus-x", + "https://dbrand.com/how-to-apply/pebble-time", + "https://dbrand.com/how-to-apply/pebble-watch", + "https://dbrand.com/how-to-apply/pixel", + "https://dbrand.com/how-to-apply/pixel-2", + "https://dbrand.com/how-to-apply/pixel-2-xl", + "https://dbrand.com/how-to-apply/pixel-3", + "https://dbrand.com/how-to-apply/pixel-3a", + "https://dbrand.com/how-to-apply/pixel-3a-xl", + "https://dbrand.com/how-to-apply/pixel-3-xl", + "https://dbrand.com/how-to-apply/pixel-4", + "https://dbrand.com/how-to-apply/pixel-4-xl", + "https://dbrand.com/how-to-apply/pixelbook", + "https://dbrand.com/how-to-apply/pixelbook-go", + "https://dbrand.com/how-to-apply/pixel-xl", + "https://dbrand.com/how-to-apply/playstation-3", + "https://dbrand.com/how-to-apply/playstation-4", + "https://dbrand.com/how-to-apply/playstation-4-pro", + "https://dbrand.com/how-to-apply/playstation-4-slim", + "https://dbrand.com/how-to-apply/playstation-vita", + "https://dbrand.com/how-to-apply/pocophone-f1", + "https://dbrand.com/how-to-apply/razer-blade-15.6-skins-2018-advanced-no-ethernet-gtx", + "https://dbrand.com/how-to-apply/razer-blade-15.6-skins-2018-base-with-ethernet-gtx", + "https://dbrand.com/how-to-apply/razer-blade-15.6-skins-2019-advanced-no-ethernet-rtx", + "https://dbrand.com/how-to-apply/razer-blade-pro-17-2019", + "https://dbrand.com/how-to-apply/razer-phone", + "https://dbrand.com/how-to-apply/razer-phone-2", + "https://dbrand.com/how-to-apply/redmi-k20", + "https://dbrand.com/how-to-apply/redmi-k20-pro", + "https://dbrand.com/how-to-apply/surface-book", + "https://dbrand.com/how-to-apply/surface-book-2-13", + "https://dbrand.com/how-to-apply/surface-book-2-15", + "https://dbrand.com/how-to-apply/surface-go", + "https://dbrand.com/how-to-apply/surface-laptop", + "https://dbrand.com/how-to-apply/surface-laptop-2", + "https://dbrand.com/how-to-apply/surface-laptop-3-13", + "https://dbrand.com/how-to-apply/surface-laptop-3-15", + "https://dbrand.com/how-to-apply/surface-pro-2017", + "https://dbrand.com/how-to-apply/surface-pro-4", + "https://dbrand.com/how-to-apply/surface-pro-6", + "https://dbrand.com/how-to-apply/surface-pro-7", + "https://dbrand.com/how-to-apply/surface-pro-x", + "https://dbrand.com/how-to-apply/tesla-cybertruck", + "https://dbrand.com/how-to-apply/xbox-360", + "https://dbrand.com/how-to-apply/xbox-one", + "https://dbrand.com/how-to-apply/xbox-one-s", + "https://dbrand.com/how-to-apply/xbox-one-x", + "https://dbrand.com/how-to-apply/xiaomi-mi-9t", + "https://dbrand.com/how-to-apply/xiaomi-mi-9t-pro", + "https://dbrand.com/how-to-apply/xperia-z1", + "https://dbrand.com/how-to-apply/xperia-z2", + "https://dbrand.com/how-to-apply/xperia-z3", + "https://dbrand.com/how-to-apply/xperia-z3-compact", + "https://dbrand.com/how-to-apply/xperia-z5", + "https://dbrand.com/how-to-apply/xperia-z5-compact", + "https://dbrand.com/how-to-apply/xperia-z5-premium", + "https://dbrand.com/how-to-apply/xperia-z-ultra", + "https://dbrand.com/how-to-apply/xps-13-9370", + "https://dbrand.com/how-to-apply/xps-13-9380", + "https://dbrand.com/how-to-apply/xps-15-2-in-1-9575", + "https://dbrand.com/how-to-apply/xps-15-7590", + "https://dbrand.com/how-to-apply/xps-15-9570", + "https://dbrand.com/how-to-apply/zenfone-2", + ], +} + + +class DbrandCog(commands.Cog): + """ + dbrand functions for J.A.R.V.I.S. + + Mostly support functions + """ + + def __init__(self, bot): + self.bot = bot + self.base_url = "https://dbrand.com/" + + @commands.group(name="db", pass_context=True) + async def _db(self, ctx): + if ctx.invoked_subcommand is None: + await ctx.send( + "Available subcommands: `grip`, `support`, " + + "`skin`, `prism`, `shipping`" + ) + + @_db.command(name="skin", aliases=["skins", "tape"]) + async def _skin(self, ctx): + await ctx.send(self.base_url + "shop/skins") + + @_db.command(name="grip") + async def _grip(self, ctx): + await ctx.send(self.base_url + "shop/grip/#grip-devices") + + @_db.command(name="support") + async def _support(self, ctx): + await ctx.send(self.base_url + "contact") + + @_db.command(name="shipping") + async def _shipping(self, ctx, *, search: str): + if not re.match(search, r"^[A-Z-]+$", re.IGNORECASE): + await ctx.send("Please use text to search for shipping.") + search = "-".join(search.split(" ")) + matches = [ + x + for x in DBRAND_DATA["shippingArray"] + if x.contains(search.lower()) + ] + if len(matches) > 0: + link = self.base_url + "/shipping/" + matches[0] + dest = matches[0] + embed = build_embed( + "Shipping to {}".format(dest), + desc="[View all shipping destinations]" + + "(https://dbrand.com/shipping)", + color="#FFBB00", + url=link, + image="https://upload.wikimedia.org/wikipedia/commons/thumb" + + "/b/b4/Dbrand_logo.svg/2560px-Dbrand_logo.svg.png", + thumbnail="https://dev.zevaryx.com/db_logo.png", + ) + await ctx.send(embed=embed) + + +def setup(bot): + bot.add_cog(DbrandCog(bot))