From 51d727eb70809a64e3bebcabc09d61c9aba0742c Mon Sep 17 00:00:00 2001 From: Konstantinos Efthymiadis Date: Thu, 9 Feb 2023 01:35:11 +0200 Subject: [PATCH 1/6] Adding the new plugin: basketball --- docs/source/Plugins/fun.rst | 5 + .../plugins/downloaded/basketball/__init__.py | 0 .../plugins/downloaded/basketball/info.py | 15 ++ .../plugins/downloaded/basketball/main.py | 209 ++++++++++++++++++ src/honeybot/settings/PLUGINS.conf | 1 + src/honeybot/test_plugin_script.py | 4 +- 6 files changed, 232 insertions(+), 2 deletions(-) create mode 100644 src/honeybot/plugins/downloaded/basketball/__init__.py create mode 100644 src/honeybot/plugins/downloaded/basketball/info.py create mode 100644 src/honeybot/plugins/downloaded/basketball/main.py diff --git a/docs/source/Plugins/fun.rst b/docs/source/Plugins/fun.rst index 9041ab4..3cf7a29 100644 --- a/docs/source/Plugins/fun.rst +++ b/docs/source/Plugins/fun.rst @@ -36,6 +36,11 @@ Magic 8 Ball .. automodule:: plugins.downloaded.magic_ball.main :members: +Basketball +^^^^^ +.. automodule:: plugins.downloaded.basketball.main + :members: + Monopoly ^^^^^^^^ TODO diff --git a/src/honeybot/plugins/downloaded/basketball/__init__.py b/src/honeybot/plugins/downloaded/basketball/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/src/honeybot/plugins/downloaded/basketball/info.py b/src/honeybot/plugins/downloaded/basketball/info.py new file mode 100644 index 0000000..bb6d197 --- /dev/null +++ b/src/honeybot/plugins/downloaded/basketball/info.py @@ -0,0 +1,15 @@ +NAME = "basketball.py" + +ORIGINAL_AUTHORS = ["Konstantinos Efthymiadis"] + +ABOUT = """ +Given the event and year as parameters, the plugin will return the countries that won the medal that year +Given the event and country as parameters, the plugin will return the number of medals this country has won +""" + +COMMANDS = """ +>>> .basketball <> <> +returns a string with all the information +>>> .basketball <> <> +returns a table with all the medals of all the years +""" diff --git a/src/honeybot/plugins/downloaded/basketball/main.py b/src/honeybot/plugins/downloaded/basketball/main.py new file mode 100644 index 0000000..8e93d86 --- /dev/null +++ b/src/honeybot/plugins/downloaded/basketball/main.py @@ -0,0 +1,209 @@ +# -*- coding: utf-8 -*- +""" +[basketball.py] +Basketball Plugin + +[Author] +Konstantinos Efthymiadis + +[About] +Given the event and year as parameters, the plugin will return the countries that won the medal that year +Given the event and country as parameters, the plugin will return the number of medals this country has won + +[Commands] +>>> .basketball <> <> +returns a string with all the information +>>> .basketball <> <> +returns a table with all the medals of all the years +""" + +dataEuroBasket = { + "1935": ["Latvia", "Spain", "Czechoslovakia", "24-18"], + "1937": ["Lithuania", "Italy", "France", "24-23"], + "1939": ["Lithuania", "Latvia", "Poland", "No playOffs"], + "1946": ["Czechoslovakia", "Italy", "Hungary", "34-32"], + "1947": ["USSR", "Czechoslovakia", "Egypt", "56-37"], + "1949": ["Egypt", "France", "Greece", "No playOffs"], + "1951": ["USSR", "Czechoslovakia", "France", "45-44"], + "1953": ["USSR", "Hungary", "France", "No playOffs"], + "1955": ["Hungary", "Czechoslovakia", "USSR", "No playOffs"], + "1957": ["USSR", "Bulgaria", "Czechoslovakia", "No playOffs"], + "1959": ["USSR", "Czechoslovakia", "France", "No playOffs"], + "1961": ["USSR", "Yugoslavia", "Bulgaria", "60-53"], + "1963": ["USSR", "Poland", "Yugoslavia", "61-45"], + "1965": ["USSR", "Yugoslavia", "Poland", "58-49"], + "1967": ["USSR", "Czechoslovakia", "Poland", "89-77"], + "1969": ["USSR", "Yugoslavia", "Czechoslovakia", "81-72"], + "1971": ["USSR", "Yugoslavia", "Italy", "69-64"], + "1973": ["Yugoslavia", "Spain", "USSR", "78-67"], + "1975": ["Yugoslavia", "USSR", "Italy", "No playOffs"], + "1977": ["Yugoslavia", "USSR", "Czechoslovakia", "74-61"], + "1979": ["USSR", "Israel", "Yugoslavia", "98-76"], + "1981": ["USSR", "Yugoslavia", "Czechoslovakia", "84-67"], + "1983": ["Italy", "Spain", "USSR", "105-96"], + "1985": ["USSR", "Czechoslovakia", "Italy", "120-89"], + "1987": ["Greece", "USSR", "Yugoslavia", "103-101"], + "1989": ["Yugoslavia", "Greece", "USSR", "98-77"], + "1991": ["Yugoslavia", "Italy", "Spain", "88-73"], + "1993": ["Germany", "Russia", "Croatia", "71-70"], + "1995": ["Yugoslavia", "Lithuania", "Croatia", "96-90"], + "1997": ["Yugoslavia", "Italy", "Russia", "61-49"], + "1999": ["Italy", "Spain", "Yugoslavia", "64-56"], + "2001": ["Yugoslavia", "Turkey", "Spain", "78-69"], + "2003": ["Lithuania", "Spain", "Italy", "93-84"], + "2005": ["Greece", "Germany", "France", "78-62"], + "2007": ["Russia", "Spain", "Lithuania", "60-59"], + "2009": ["Spain", "Serbia", "Greece", "85-63"], + "2011": ["Spain", "France", "Russia", "98-85"], + "2013": ["France", "Lithuania", "Spain", "80-66"], + "2015": ["Spain", "Lithuania", "France", "80-63"], + "2017": ["Slovenia", "Serbia", "Spain", "93-85"], + "2022": ["Spain", "France", "Germany", "88-76"] +} +dataWorldCup = { + "1950": ["Argentina", "USA", "Chile", "64-50"], + "1954": ["USA", "Brazil", "Philippines", "62-41"], + "1959": ["Brazil", "USA", "Chile", "81-67"], + "1963": ["Brazil", "Yugoslavia", "USSR", "90-71"], + "1967": ["USSR", "Yugoslavia", "Brazil", "71-59"], + "1970": ["Yugoslavia", "Brazil", "USSR", "80-55"], + "1974": ["USSR", "Yugoslavia", "USA", "79-82"], + "1978": ["Yugoslavia", "USSR", "Brazil", "82-81"], + "1982": ["USSR", "USA", "Yugoslavia", "95-94"], + "1986": ["USA", "USSR", "Yugoslavia", "87-85"], + "1990": ["Yugoslavia", "USSR", "USA", "92-75"], + "1994": ["USA", "Russia", "Croatia", "137-91"], + "1998": ["Yugoslavia", "Russia", "USA", "64-62"], + "2002": ["Yugoslavia", "Argentina", "Germany", "84-77"], + "2006": ["Spain", "Greece", "USA", "70-47"], + "2010": ["USA", "Turkey", "Lithuania", "81-64"], + "2014": ["USA", "Serbia", "France", "129-92"], + "2019": ["Spain", "Argentina", "France", "95-75"] +} + + +class Plugin: + def __init__(self): + pass + + def __accordingToYear__(year, event): + dataEvent = {} + if event == "eu": + dataEvent = dataEuroBasket + elif event == "wc": + dataEvent = dataWorldCup + + if year in dataEvent: + data = dataEvent.get(year) + text = "Gold: " + data[0] + "\nSilver: " + data[1] + "\nBronze: " + data[2] + if data[3] != "No playOffs": + text += "\nFinal Score:\n" + data[0] + " " + data[3] + " " + data[1] + return text + else: + return "No results for that year" + + def __accordingToCountry__(country, event): + dataEvent = {} + if event == "eu": + dataEvent = dataEuroBasket + elif event == "wc": + dataEvent = dataWorldCup + + goldMedal = 0 + silverMedal = 0 + bronzeMedal = 0 + + for value in dataEvent.values(): + if value[0].upper() == country.upper(): + goldMedal += 1 + elif value[1].upper() == country.upper(): + silverMedal += 1 + elif value[2].upper() == country.upper(): + bronzeMedal += 1 + + if goldMedal == silverMedal and silverMedal == bronzeMedal and bronzeMedal == 0: + return "The country: " + country + " does not have any medal" + else: + text = country + " Medals:\n" + "Gold: " + str(goldMedal) + "\nSilver: " + str( + silverMedal) + "\nBronze: " + str(bronzeMedal) + "\nTotal Medals: " + str( + goldMedal + silverMedal + bronzeMedal) + return text + + def __createTable__(maxLen, word): + whiteCharacters = maxLen - len(word) + text = "" + for i in range(0, whiteCharacters // 2): + text += " " + text += word + for i in range(whiteCharacters // 2, whiteCharacters): + text += " " + text += "|" + return text + + def __allTheMedalsAllTheYears__(event): + dataEvent = {} + text="" + if event == "eu": + dataEvent = dataEuroBasket + text="European Basketball Championship\n" + elif event == "wc": + dataEvent = dataWorldCup + text="FIBA Basketball World Cup\n" + + if not dataEvent: + return + + maxForGold = -1 + maxForSilver = -1 + maxForBronze = -1 + + for value in dataEvent.values(): + if len(value[0]) > maxForGold: + maxForGold = len(value[0]) + if len(value[1]) > maxForSilver: + maxForSilver = len(value[1]) + if len(value[2]) > maxForBronze: + maxForBronze = len(value[2]) + + goldMedal = "Gold Medal" + silverMedal = "Silver Medal" + bronzeMedal = "Bronze Medal" + + if len(goldMedal) > maxForGold: + maxForGold = len(goldMedal) + if len(silverMedal) > maxForSilver: + maxForSilver = len(silverMedal) + if len(bronzeMedal) > maxForBronze: + maxForBronze = len(bronzeMedal) + + text += "|Year|" + text += Plugin.__createTable__(maxForGold, goldMedal) + text += Plugin.__createTable__(maxForSilver, silverMedal) + text += Plugin.__createTable__(maxForBronze, bronzeMedal) + text += "\n" + + for key in dataEvent.keys(): + text += "|" + key + "|" + temp = dataEvent.get(key) + + text += Plugin.__createTable__(maxForGold, temp[0]) + text += Plugin.__createTable__(maxForSilver, temp[1]) + text += Plugin.__createTable__(maxForBronze, temp[2]) + text += "\n" + + return text + + def run(self, incoming, methods, info, bot_info): + try: + msgs = info["args"][1:][0].split() + if info["command"] == "PRIVMSG" and len(msgs) == 3 and msgs[0] == ".basketball": + event = msgs[1] + if msgs[2] == "all": + methods["send"](info["address"], Plugin.__allTheMedalsAllTheYears__(msgs[1])) + elif msgs[2].isnumeric(): + methods["send"](info["address"], Plugin.__accordingToYear__(msgs[2], msgs[1])) + else: + methods["send"](info["address"], Plugin.__accordingToCountry__(msgs[2], msgs[1])) + + except Exception as e: + print("Something Wrong. There is a Plugin Error: ", e) diff --git a/src/honeybot/settings/PLUGINS.conf b/src/honeybot/settings/PLUGINS.conf index ed146a8..5b33ff2 100644 --- a/src/honeybot/settings/PLUGINS.conf +++ b/src/honeybot/settings/PLUGINS.conf @@ -2,3 +2,4 @@ help age caesar_cipher greet +basketball diff --git a/src/honeybot/test_plugin_script.py b/src/honeybot/test_plugin_script.py index 1eaf80a..13f1c84 100644 --- a/src/honeybot/test_plugin_script.py +++ b/src/honeybot/test_plugin_script.py @@ -3,7 +3,7 @@ ↓↓↓↓ """ import time -from plugins import roman_numeral as test_plugin +from plugins import basketball as test_plugin test_plugin = test_plugin.Plugin @@ -69,7 +69,7 @@ def send_target(self, target, msg): 4.1 User quitting a channel """ - incoming_command_test = ".roman 420" + incoming_command_test = ".basketball eu all" Tester("message", incoming_command_test) # Tester('user_join', incoming_command_test) From 08caba7f49ded74316052fdb21dacf5fd4293684 Mon Sep 17 00:00:00 2001 From: Konstantinos Efthymiadis Date: Thu, 9 Feb 2023 11:24:32 +0200 Subject: [PATCH 2/6] Editing the fun.rst --- docs/source/Plugins/fun.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/source/Plugins/fun.rst b/docs/source/Plugins/fun.rst index 3cf7a29..762f88e 100644 --- a/docs/source/Plugins/fun.rst +++ b/docs/source/Plugins/fun.rst @@ -37,7 +37,7 @@ Magic 8 Ball :members: Basketball -^^^^^ +^^^^^^^^^^ .. automodule:: plugins.downloaded.basketball.main :members: From 3d9fdab8d4d161646dd96aab6f57806e70ce9776 Mon Sep 17 00:00:00 2001 From: Konstantinos Efthymiadis Date: Thu, 16 Feb 2023 11:34:38 +0200 Subject: [PATCH 3/6] add the basketball plugin in README.md --- README.md | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/README.md b/README.md index 45a8983..48c6c72 100644 --- a/README.md +++ b/README.md @@ -82,7 +82,7 @@ GUI clients are used to manage plugins, launch bot as well as specify credential ## ⌚ Current Plugins | Plugin | Description | Contributor | -| ---------------------- | ------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------- | +|------------------------|---------------------------------------------------------------------------------------| -------------------------------------------------------------------------------------------------------- | | 💎 bitcoin | Get price of bitcoin | [@Macr0Nerd](https://github.com/Macr0Nerd) | | ⏲ caesar cipher | Encode your text | [@kylegalloway](https://github.com/kylegalloway) | | 🔢 calc | Evaluates maths expressions | [@Abdur-rahmaanJ](https://github.com/Abdur-rahmaanJ) | @@ -90,8 +90,8 @@ GUI clients are used to manage plugins, launch bot as well as specify credential | 🍃 conv sniff | Set triggers like how many times a word occur for one or more words and send response | [@Abdur-rahmaanJ](https://github.com/Abdur-rahmaanJ) | | ❄ greet | Demo plugin | [@Abdur-rahmaanJ](https://github.com/Abdur-rahmaanJ) | | ⛓ installed_modules | Checks dependencies installed | [@Abdur-rahmaanJ](https://github.com/Abdur-rahmaanJ) | -| 🕶 joke | Get random joke | [@Abdur-rahmaanJ](https://github.com/Abdur-rahmaanJ), [@colbyjayallen](https://github.com/colbyjayallen) | -| ❓ self Trivia | Random trivia | [@ajimenezUCLA](https://github.com/ajimenezUCLA) | +| 🕶 joke | Get random joke | [@Abdur-rahmaanJ](https://github.com/Abdur-rahmaanJ), [@colbyjayallen](https://github.com/colbyjayallen) | +| ❓ self Trivia | Random trivia | [@ajimenezUCLA](https://github.com/ajimenezUCLA) | | 💢 username | Username generator | [@Abdur-rahmaanJ](https://github.com/Abdur-rahmaanJ), [@sseryani](https://github.com/sseryani) | | 📜 quotes | Inspirational quotes | [@German-Corpaz](https://github.com/German-Corpaz) | | 📖 dictionary | Returns meaning of word | [@iamnishant14](https://github.com/iamnishant14) | @@ -100,9 +100,9 @@ GUI clients are used to manage plugins, launch bot as well as specify credential | 📚 wikipedia | Returns a wikipedia article | [@Macr0Nerd](https://github.com/Macr0Nerd) | | 🗿 translate | Google translate plugin | [@a-deeb](https://github.com/a-deeb) | | 📑 test | Runs tests | [@Abdur-rahmaanJ](https://github.com/Abdur-rahmaanJ) | -| ⛅️ weather | Returns weather info for a given location | [@Macr0Nerd](https://github.com/Macr0Nerd) | +| ⛅️ weather | Returns weather info for a given location | [@Macr0Nerd](https://github.com/Macr0Nerd) | | ✉️ mail | Send emails within the chat | [@TannerFry](https://github.com/TannerFry) | -| 🕴️ hangman | Play hangman in the chat | [@JustinWalker4179](https://github.com/justinwalker4179) | +| 🕴️ hangman | Play hangman in the chat | [@JustinWalker4179](https://github.com/justinwalker4179) | | 🎂 age | Takes in birthday and outputs age | [@JustinWalker4179](https://github.com/justinwalker4179) | | ✔️ fact | Returns a random fact | [@JustinWalker4179](https://github.com/justinwalker4179) | | 🔍 google | Returns three search results from google | [@JustinWalker4179](https://github.com/justinwalker4179) | @@ -110,29 +110,30 @@ GUI clients are used to manage plugins, launch bot as well as specify credential | 📝 log | Logs the chat into a log file | [@RiceAbove](https://github.com/RiceAbove) | | 🚪 joins | Greets everyone who joins the channel | [@RiceAbove](https://github.com/RiceAbove) | | 📅 date | Posts the current date | [@RiceAbove](https://github.com/RiceAbove) | -| 🕵️‍ riddle | Returns a random riddle | [@AngeloGiacco](https://github.com/AngeloGiacco) | -| 🗞 news | Gets the top 10 headlines from bbc world news | [@AngeloGiacco](https://github.com/AngeloGiacco) | +| 🕵️‍ riddle | Returns a random riddle | [@AngeloGiacco](https://github.com/AngeloGiacco) | +| 🗞 news | Gets the top 10 headlines from bbc world news | [@AngeloGiacco](https://github.com/AngeloGiacco) | | 📝 horoscope | Gets your daily horoscope for your starsign | [@AngeloGiacco](https://github.com/AngeloGiacco) | | 💵 currency converter | Converts currencies | [@AngeloGiacco](https://github.com/AngeloGiacco) | | 🔫 russian_roulette | May or may not kick you off the channel | [@AngeloGiacco](https://github.com/AngeloGiacco) | | 🏨 monopoly | Honeybot now supports the world's worst game! | [@AngeloGiacco](https://github.com/AngeloGiacco) | -| ⚽️ transfer_rumour | Shows the day's transfer rumours | [@AngeloGiacco](https://github.com/AngeloGiacco) | +| ⚽️ transfer_rumour | Shows the day's transfer rumours | [@AngeloGiacco](https://github.com/AngeloGiacco) | | 🃏 blackjack/21 | Play 21 on honeybot! | [@AngeloGiacco](https://github.com/AngeloGiacco) | | 🤒 corona | Get the latest news on coronavirus with honeybot! | [@AngeloGiacco](https://github.com/AngeloGiacco) | | 📖 diary | Keep a diary with honeybot | [@AngeloGiacco](https://github.com/AngeloGiacco) | -| 🛩 flight | Gets flight info from flightradar24 | [@AngeloGiacco](https://github.com/AngeloGiacco) | +| 🛩 flight | Gets flight info from flightradar24 | [@AngeloGiacco](https://github.com/AngeloGiacco) | | 🎲 roll | Rolls a dice | [@GlennToms](https://github.com/GlennToms) | -| ❓ help | Show link to plugin's information page | [@edumello](https://github.com/edumello) | -| ✅ channeljoin | Join command for bot | [@marceloyb](https://github.com/marceloyb) | +| ❓ help | Show link to plugin's information page | [@edumello](https://github.com/edumello) | +| ✅ channeljoin | Join command for bot | [@marceloyb](https://github.com/marceloyb) | | :page_with_curl: comic | Returns a random comic | [@mboekhold](https://github.com/mboekhold) | | 📝 todo | Makes a to do list | [@h-ranjan1110](https://github.com/h-ranjan1110) | | 🎱 Magic 8 Ball | Answer questions using magic 8 ball | [@ZakariaTalhami](https://github.com/ZakariaTalhami) | -| 🎟 Random Excuse | Generates a random excuse for you. | [@rakeshseal0](https://github.com/rakeshseal0) | +| 🎟 Random Excuse | Generates a random excuse for you. | [@rakeshseal0](https://github.com/rakeshseal0) | | 🦆 DuckDuckGo Search | Search queries in duckduckgo and return abstract. | [@rakeshseal0](https://github.com/rakeshseal0) | -| 🖼 Random Image | Returns a random image url. | [@rakeshseal0](https://github.com/rakeshseal0) | -| 🛢 URL Shortener | Shortens a url | [@rakeshseal0](https://github.com/rakeshseal0) | +| 🖼 Random Image | Returns a random image url. | [@rakeshseal0](https://github.com/rakeshseal0) | +| 🛢 URL Shortener | Shortens a url | [@rakeshseal0](https://github.com/rakeshseal0) | | 😁 emoji | Returns emoji meaning | [@deadex-ng](https://github.com/deadex-ng) | | :birthday: birthday | Shows birthday match probability on a people group. | [@paulosgf](https://github.com/paulosgf) | +| basketball | Shows information about the medals of euroBasket and Basketball world cup | [@kefthymic](https://github.com/kefthymic) | ## ⚡ Quickstart From 0515acde9bcbd538783714b4fa6689fc69cdc93a Mon Sep 17 00:00:00 2001 From: kefthymic <74056501+kefthymic@users.noreply.github.com> Date: Thu, 16 Feb 2023 11:40:58 +0200 Subject: [PATCH 4/6] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 48c6c72..4a6be31 100644 --- a/README.md +++ b/README.md @@ -133,7 +133,7 @@ GUI clients are used to manage plugins, launch bot as well as specify credential | 🛢 URL Shortener | Shortens a url | [@rakeshseal0](https://github.com/rakeshseal0) | | 😁 emoji | Returns emoji meaning | [@deadex-ng](https://github.com/deadex-ng) | | :birthday: birthday | Shows birthday match probability on a people group. | [@paulosgf](https://github.com/paulosgf) | -| basketball | Shows information about the medals of euroBasket and Basketball world cup | [@kefthymic](https://github.com/kefthymic) | +| 🏀 basketball | Shows information about the medals of euroBasket and Basketball world cup | [@kefthymic](https://github.com/kefthymic) | ## ⚡ Quickstart From fdeff3aaf495259b06e12af52b3eed092b4c041e Mon Sep 17 00:00:00 2001 From: "pre-commit-ci-lite[bot]" <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com> Date: Thu, 16 Feb 2023 10:14:09 +0000 Subject: [PATCH 5/6] [pre-commit.ci lite] apply automatic fixes --- src/honeybot/plugins/downloaded/basketball/main.py | 1 - 1 file changed, 1 deletion(-) diff --git a/src/honeybot/plugins/downloaded/basketball/main.py b/src/honeybot/plugins/downloaded/basketball/main.py index 8e93d86..06d1c20 100644 --- a/src/honeybot/plugins/downloaded/basketball/main.py +++ b/src/honeybot/plugins/downloaded/basketball/main.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- """ [basketball.py] Basketball Plugin From 3971b92692602bce15d3f7c6a003095b29a336ff Mon Sep 17 00:00:00 2001 From: Konstantinos Efthymiadis Date: Thu, 16 Feb 2023 12:43:55 +0200 Subject: [PATCH 6/6] format README and main.py --- README.md | 45 +++++++++---------- .../plugins/downloaded/basketball/main.py | 29 ++++++++---- 2 files changed, 42 insertions(+), 32 deletions(-) diff --git a/README.md b/README.md index 4a6be31..8132fbe 100644 --- a/README.md +++ b/README.md @@ -2,9 +2,6 @@
- - - [![PyPI version](https://badge.fury.io/py/honeybot.png)](https://badge.fury.io/py/honeybot) @@ -15,12 +12,14 @@ [![OpenSSF Scorecard](https://api.securityscorecards.dev/projects/github.com/pyhoneybot/honeybot/badge)](https://api.securityscorecards.dev/projects/github.com/pyhoneybot/honeybot) ## Launching pyhoneybot Rewards - Contributed to pyhoneybot? Here is a big thank you from our community to you. - Claim your badge and showcase them with pride. - Let us inspire more folks ! - ![pyhoneybot Badges](https://aviyel.com/assets/uploads/rewards/share/project/84/512/share.png) - ### **[Claim Now!](https://aviyel.com/projects/84/pyhoneybot/rewards)** +Contributed to pyhoneybot? Here is a big thank you from our community to you. +Claim your badge and showcase them with pride. +Let us inspire more folks ! + +![pyhoneybot Badges](https://aviyel.com/assets/uploads/rewards/share/project/84/512/share.png) + +### **[Claim Now!](https://aviyel.com/projects/84/pyhoneybot/rewards)**
🇲🇺 🇺🇸 🇨🇦 🇦🇷 🇮🇳 🇬🇧 🇬🇬 🇧🇷 🇸🇽 🇵🇱 🇩🇪 🇲🇼 @@ -82,7 +81,7 @@ GUI clients are used to manage plugins, launch bot as well as specify credential ## ⌚ Current Plugins | Plugin | Description | Contributor | -|------------------------|---------------------------------------------------------------------------------------| -------------------------------------------------------------------------------------------------------- | +| ---------------------- | ------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------- | | 💎 bitcoin | Get price of bitcoin | [@Macr0Nerd](https://github.com/Macr0Nerd) | | ⏲ caesar cipher | Encode your text | [@kylegalloway](https://github.com/kylegalloway) | | 🔢 calc | Evaluates maths expressions | [@Abdur-rahmaanJ](https://github.com/Abdur-rahmaanJ) | @@ -90,8 +89,8 @@ GUI clients are used to manage plugins, launch bot as well as specify credential | 🍃 conv sniff | Set triggers like how many times a word occur for one or more words and send response | [@Abdur-rahmaanJ](https://github.com/Abdur-rahmaanJ) | | ❄ greet | Demo plugin | [@Abdur-rahmaanJ](https://github.com/Abdur-rahmaanJ) | | ⛓ installed_modules | Checks dependencies installed | [@Abdur-rahmaanJ](https://github.com/Abdur-rahmaanJ) | -| 🕶 joke | Get random joke | [@Abdur-rahmaanJ](https://github.com/Abdur-rahmaanJ), [@colbyjayallen](https://github.com/colbyjayallen) | -| ❓ self Trivia | Random trivia | [@ajimenezUCLA](https://github.com/ajimenezUCLA) | +| 🕶 joke | Get random joke | [@Abdur-rahmaanJ](https://github.com/Abdur-rahmaanJ), [@colbyjayallen](https://github.com/colbyjayallen) | +| ❓ self Trivia | Random trivia | [@ajimenezUCLA](https://github.com/ajimenezUCLA) | | 💢 username | Username generator | [@Abdur-rahmaanJ](https://github.com/Abdur-rahmaanJ), [@sseryani](https://github.com/sseryani) | | 📜 quotes | Inspirational quotes | [@German-Corpaz](https://github.com/German-Corpaz) | | 📖 dictionary | Returns meaning of word | [@iamnishant14](https://github.com/iamnishant14) | @@ -100,9 +99,9 @@ GUI clients are used to manage plugins, launch bot as well as specify credential | 📚 wikipedia | Returns a wikipedia article | [@Macr0Nerd](https://github.com/Macr0Nerd) | | 🗿 translate | Google translate plugin | [@a-deeb](https://github.com/a-deeb) | | 📑 test | Runs tests | [@Abdur-rahmaanJ](https://github.com/Abdur-rahmaanJ) | -| ⛅️ weather | Returns weather info for a given location | [@Macr0Nerd](https://github.com/Macr0Nerd) | +| ⛅️ weather | Returns weather info for a given location | [@Macr0Nerd](https://github.com/Macr0Nerd) | | ✉️ mail | Send emails within the chat | [@TannerFry](https://github.com/TannerFry) | -| 🕴️ hangman | Play hangman in the chat | [@JustinWalker4179](https://github.com/justinwalker4179) | +| 🕴️ hangman | Play hangman in the chat | [@JustinWalker4179](https://github.com/justinwalker4179) | | 🎂 age | Takes in birthday and outputs age | [@JustinWalker4179](https://github.com/justinwalker4179) | | ✔️ fact | Returns a random fact | [@JustinWalker4179](https://github.com/justinwalker4179) | | 🔍 google | Returns three search results from google | [@JustinWalker4179](https://github.com/justinwalker4179) | @@ -110,30 +109,30 @@ GUI clients are used to manage plugins, launch bot as well as specify credential | 📝 log | Logs the chat into a log file | [@RiceAbove](https://github.com/RiceAbove) | | 🚪 joins | Greets everyone who joins the channel | [@RiceAbove](https://github.com/RiceAbove) | | 📅 date | Posts the current date | [@RiceAbove](https://github.com/RiceAbove) | -| 🕵️‍ riddle | Returns a random riddle | [@AngeloGiacco](https://github.com/AngeloGiacco) | -| 🗞 news | Gets the top 10 headlines from bbc world news | [@AngeloGiacco](https://github.com/AngeloGiacco) | +| 🕵️‍ riddle | Returns a random riddle | [@AngeloGiacco](https://github.com/AngeloGiacco) | +| 🗞 news | Gets the top 10 headlines from bbc world news | [@AngeloGiacco](https://github.com/AngeloGiacco) | | 📝 horoscope | Gets your daily horoscope for your starsign | [@AngeloGiacco](https://github.com/AngeloGiacco) | | 💵 currency converter | Converts currencies | [@AngeloGiacco](https://github.com/AngeloGiacco) | | 🔫 russian_roulette | May or may not kick you off the channel | [@AngeloGiacco](https://github.com/AngeloGiacco) | | 🏨 monopoly | Honeybot now supports the world's worst game! | [@AngeloGiacco](https://github.com/AngeloGiacco) | -| ⚽️ transfer_rumour | Shows the day's transfer rumours | [@AngeloGiacco](https://github.com/AngeloGiacco) | +| ⚽️ transfer_rumour | Shows the day's transfer rumours | [@AngeloGiacco](https://github.com/AngeloGiacco) | | 🃏 blackjack/21 | Play 21 on honeybot! | [@AngeloGiacco](https://github.com/AngeloGiacco) | | 🤒 corona | Get the latest news on coronavirus with honeybot! | [@AngeloGiacco](https://github.com/AngeloGiacco) | | 📖 diary | Keep a diary with honeybot | [@AngeloGiacco](https://github.com/AngeloGiacco) | -| 🛩 flight | Gets flight info from flightradar24 | [@AngeloGiacco](https://github.com/AngeloGiacco) | +| 🛩 flight | Gets flight info from flightradar24 | [@AngeloGiacco](https://github.com/AngeloGiacco) | | 🎲 roll | Rolls a dice | [@GlennToms](https://github.com/GlennToms) | -| ❓ help | Show link to plugin's information page | [@edumello](https://github.com/edumello) | -| ✅ channeljoin | Join command for bot | [@marceloyb](https://github.com/marceloyb) | +| ❓ help | Show link to plugin's information page | [@edumello](https://github.com/edumello) | +| ✅ channeljoin | Join command for bot | [@marceloyb](https://github.com/marceloyb) | | :page_with_curl: comic | Returns a random comic | [@mboekhold](https://github.com/mboekhold) | | 📝 todo | Makes a to do list | [@h-ranjan1110](https://github.com/h-ranjan1110) | | 🎱 Magic 8 Ball | Answer questions using magic 8 ball | [@ZakariaTalhami](https://github.com/ZakariaTalhami) | -| 🎟 Random Excuse | Generates a random excuse for you. | [@rakeshseal0](https://github.com/rakeshseal0) | +| 🎟 Random Excuse | Generates a random excuse for you. | [@rakeshseal0](https://github.com/rakeshseal0) | | 🦆 DuckDuckGo Search | Search queries in duckduckgo and return abstract. | [@rakeshseal0](https://github.com/rakeshseal0) | -| 🖼 Random Image | Returns a random image url. | [@rakeshseal0](https://github.com/rakeshseal0) | -| 🛢 URL Shortener | Shortens a url | [@rakeshseal0](https://github.com/rakeshseal0) | +| 🖼 Random Image | Returns a random image url. | [@rakeshseal0](https://github.com/rakeshseal0) | +| 🛢 URL Shortener | Shortens a url | [@rakeshseal0](https://github.com/rakeshseal0) | | 😁 emoji | Returns emoji meaning | [@deadex-ng](https://github.com/deadex-ng) | | :birthday: birthday | Shows birthday match probability on a people group. | [@paulosgf](https://github.com/paulosgf) | -| 🏀 basketball | Shows information about the medals of euroBasket and Basketball world cup | [@kefthymic](https://github.com/kefthymic) | +| 🏀 basketball | Shows information about the medals of euroBasket and Basketball world cup | [@kefthymic](https://github.com/kefthymic) | ## ⚡ Quickstart diff --git a/src/honeybot/plugins/downloaded/basketball/main.py b/src/honeybot/plugins/downloaded/basketball/main.py index 06d1c20..aa5c7f3 100644 --- a/src/honeybot/plugins/downloaded/basketball/main.py +++ b/src/honeybot/plugins/downloaded/basketball/main.py @@ -57,7 +57,7 @@ "2013": ["France", "Lithuania", "Spain", "80-66"], "2015": ["Spain", "Lithuania", "France", "80-63"], "2017": ["Slovenia", "Serbia", "Spain", "93-85"], - "2022": ["Spain", "France", "Germany", "88-76"] + "2022": ["Spain", "France", "Germany", "88-76"], } dataWorldCup = { "1950": ["Argentina", "USA", "Chile", "64-50"], @@ -77,7 +77,7 @@ "2006": ["Spain", "Greece", "USA", "70-47"], "2010": ["USA", "Turkey", "Lithuania", "81-64"], "2014": ["USA", "Serbia", "France", "129-92"], - "2019": ["Spain", "Argentina", "France", "95-75"] + "2019": ["Spain", "Argentina", "France", "95-75"], } @@ -123,9 +123,18 @@ def __accordingToCountry__(country, event): if goldMedal == silverMedal and silverMedal == bronzeMedal and bronzeMedal == 0: return "The country: " + country + " does not have any medal" else: - text = country + " Medals:\n" + "Gold: " + str(goldMedal) + "\nSilver: " + str( - silverMedal) + "\nBronze: " + str(bronzeMedal) + "\nTotal Medals: " + str( - goldMedal + silverMedal + bronzeMedal) + text = ( + country + + " Medals:\n" + + "Gold: " + + str(goldMedal) + + "\nSilver: " + + str(silverMedal) + + "\nBronze: " + + str(bronzeMedal) + + "\nTotal Medals: " + + str(goldMedal + silverMedal + bronzeMedal) + ) return text def __createTable__(maxLen, word): @@ -141,13 +150,13 @@ def __createTable__(maxLen, word): def __allTheMedalsAllTheYears__(event): dataEvent = {} - text="" + text = "" if event == "eu": dataEvent = dataEuroBasket - text="European Basketball Championship\n" + text = "European Basketball Championship\n" elif event == "wc": dataEvent = dataWorldCup - text="FIBA Basketball World Cup\n" + text = "FIBA Basketball World Cup\n" if not dataEvent: return @@ -202,7 +211,9 @@ def run(self, incoming, methods, info, bot_info): elif msgs[2].isnumeric(): methods["send"](info["address"], Plugin.__accordingToYear__(msgs[2], msgs[1])) else: - methods["send"](info["address"], Plugin.__accordingToCountry__(msgs[2], msgs[1])) + methods["send"]( + info["address"], Plugin.__accordingToCountry__(msgs[2], msgs[1]) + ) except Exception as e: print("Something Wrong. There is a Plugin Error: ", e)