From 6a23a9a6e143bb48af6e80b3fa6fbbc468ca0feb Mon Sep 17 00:00:00 2001 From: bobloy <alboblexloy@gmail.com> Date: Thu, 28 May 2020 09:38:08 -0400 Subject: [PATCH 1/7] Audiotrivia develop (#87) * conf to config and deprecated yaml load * Add hockey goal horns --- audiotrivia/data/lists/hockeygoalhorns.yaml | 125 ++++++++++++++++++++ 1 file changed, 125 insertions(+) create mode 100644 audiotrivia/data/lists/hockeygoalhorns.yaml diff --git a/audiotrivia/data/lists/hockeygoalhorns.yaml b/audiotrivia/data/lists/hockeygoalhorns.yaml new file mode 100644 index 0000000..dd825e8 --- /dev/null +++ b/audiotrivia/data/lists/hockeygoalhorns.yaml @@ -0,0 +1,125 @@ +AUTHOR: Lazar +https://www.youtube.com/watch?v=6OejNXrGkK0&list=PLEfKMmYWy5LTPwexaHOaPeYBne8j7udRq: +- Anaheim +- Ducks +- Anaheim Ducks +https://www.youtube.com/watch?v=RbUxSPoU9Yg&list=PLEfKMmYWy5LTPwexaHOaPeYBne8j7udRq&index=2: +- Arizona +- Coyotes +- Arizona Coyotes +https://www.youtube.com/watch?v=DsI0PgWADks&list=PLEfKMmYWy5LTPwexaHOaPeYBne8j7udRq&index=4: +- Boston +- Bruins +- Boston Bruins +https://www.youtube.com/watch?v=hjFTd3MJOHc&list=PLEfKMmYWy5LTPwexaHOaPeYBne8j7udRq&index=5: +- Buffalo +- Sabres +- Buffalo Sabres +https://www.youtube.com/watch?v=sn1PliBCRDY&list=PLEfKMmYWy5LTPwexaHOaPeYBne8j7udRq&index=6: +- Calgary +- Flames +- Calgary Flames +https://www.youtube.com/watch?v=3exZm6Frd18&list=PLEfKMmYWy5LTPwexaHOaPeYBne8j7udRq&index=7: +- Carolina +- Hurricanes +- Carolina Hurricanes +https://www.youtube.com/watch?v=sBeXPMkqR80&list=PLEfKMmYWy5LTPwexaHOaPeYBne8j7udRq&index=8: +- Chicago +- Blackhawks +- Chicago Blackhawks +https://www.youtube.com/watch?v=MARxzs_vCPI&list=PLEfKMmYWy5LTPwexaHOaPeYBne8j7udRq&index=9: +- Colorado +- Avalanche +- Colorado Avalanche +https://www.youtube.com/watch?v=6yYbQfOWw4k&list=PLEfKMmYWy5LTPwexaHOaPeYBne8j7udRq&index=10: +- Columbus +- Blue Jackets +- Columbus Blue Jackets +https://www.youtube.com/watch?v=Af8_9NP5lyw&list=PLEfKMmYWy5LTPwexaHOaPeYBne8j7udRq&index=11: +- Dallas +- Stars +- Dallas Stars +https://www.youtube.com/watch?v=JflfvLvY7ks&list=PLEfKMmYWy5LTPwexaHOaPeYBne8j7udRq&index=13: +- Detroit +- Red wings +- Detroit Red Wings +https://www.youtube.com/watch?v=xc422k5Tcqc&list=PLEfKMmYWy5LTPwexaHOaPeYBne8j7udRq&index=15: +- Edmonton +- Oilers +- Edmonton Oilers +https://www.youtube.com/watch?v=Dm1bjUB9HLE&list=PLEfKMmYWy5LTPwexaHOaPeYBne8j7udRq&index=16: +- Florida +- Panthers +- Florida Panthers +https://www.youtube.com/watch?v=jSgd3aIepY4&list=PLEfKMmYWy5LTPwexaHOaPeYBne8j7udRq&index=17: +- Los Angeles +- Kings +- Los Angeles Kings +https://www.youtube.com/watch?v=4Pj8hWPR9VI&list=PLEfKMmYWy5LTPwexaHOaPeYBne8j7udRq&index=18: +- Minnesota +- Wild +- Minnesota Wild +https://www.youtube.com/watch?v=rRGlUFWEBMk&list=PLEfKMmYWy5LTPwexaHOaPeYBne8j7udRq&index=19: +- Montreal +- Canadiens +- Montreal Canadiens +https://www.youtube.com/watch?v=fHTehdlMwWQ&list=PLEfKMmYWy5LTPwexaHOaPeYBne8j7udRq&index=20: +- Nashville +- Predators +- Nashville Predators +https://www.youtube.com/watch?v=4q0eNg-AbrQ&list=PLEfKMmYWy5LTPwexaHOaPeYBne8j7udRq&index=21: +- New Jersey +- Devils +- New Jersey Devils +https://www.youtube.com/watch?v=ZC514zGrL80&list=PLEfKMmYWy5LTPwexaHOaPeYBne8j7udRq&index=23: +- New York +- Islanders +- New York Islanders +https://www.youtube.com/watch?v=Zzfks2A2n38&list=PLEfKMmYWy5LTPwexaHOaPeYBne8j7udRq&index=24: +- New York +- Rangers +- New York Rangers +https://www.youtube.com/watch?v=fHlWxPRNVBc&list=PLEfKMmYWy5LTPwexaHOaPeYBne8j7udRq&index=25: +- Ottawa +- Senators +- Ottawa Senators +https://www.youtube.com/watch?v=0LsXpMiVD1E&list=PLEfKMmYWy5LTPwexaHOaPeYBne8j7udRq&index=26: +- Philadelphia +- Flyers +- Philadelphia Flyers +https://www.youtube.com/watch?v=Llw3adcNuzI&list=PLEfKMmYWy5LTPwexaHOaPeYBne8j7udRq&index=27: +- Pittsburgh +- Penguins +- Pittsburgh Penguins +https://www.youtube.com/watch?v=NZqSBkmpbLw&list=PLEfKMmYWy5LTPwexaHOaPeYBne8j7udRq&index=28: +- San Jose +- Sharks +- San Jose Sharks +https://www.youtube.com/watch?v=Q23TDOJsY1s&list=PLEfKMmYWy5LTPwexaHOaPeYBne8j7udRq&index=29: +- St. Louis +- Blues +- St. Louis Blues +https://www.youtube.com/watch?v=bdhDXxM20iM&list=PLEfKMmYWy5LTPwexaHOaPeYBne8j7udRq&index=30: +- Tampa Bay +- Lightning +- Tampa Bay Lightning +https://www.youtube.com/watch?v=2cyekaemZgs&list=PLEfKMmYWy5LTPwexaHOaPeYBne8j7udRq&index=31: +- Toronto +- Maple Leafs +- Toronto Maple Leafs +https://www.youtube.com/watch?v=CPozN-ZHpAo&list=PLEfKMmYWy5LTPwexaHOaPeYBne8j7udRq&index=32: +- Vancouver +- Canucks +- Vancouver Canucks +https://www.youtube.com/watch?v=zheGI316WXg&list=PLEfKMmYWy5LTPwexaHOaPeYBne8j7udRq&index=33: +- Vegas +- Golden Knights +- Vegas Golden Knights +https://www.youtube.com/watch?v=BH_CC1RxtfU&list=PLEfKMmYWy5LTPwexaHOaPeYBne8j7udRq&index=34: +- Washington +- Capitals +- Washington Capitals +https://www.youtube.com/watch?v=3gcahU_i9WE&list=PLEfKMmYWy5LTPwexaHOaPeYBne8j7udRq&index=35: +- Winnipeg +- Jets +- Winnipeg Jets From 0bb967ab2254e1915be056e03152dfec63aeea9a Mon Sep 17 00:00:00 2001 From: bobloy <alboblexloy@gmail.com> Date: Thu, 28 May 2020 22:42:06 -0400 Subject: [PATCH 2/7] update to 3.3.8 --- audiotrivia/audiotrivia.py | 8 +- audiotrivia/data/lists/hockeygoalhorns.yaml | 125 -------------------- audiotrivia/data/lists/nhlgoalhorns.yaml | 125 ++++++++++++++++++++ 3 files changed, 130 insertions(+), 128 deletions(-) delete mode 100644 audiotrivia/data/lists/hockeygoalhorns.yaml create mode 100644 audiotrivia/data/lists/nhlgoalhorns.yaml diff --git a/audiotrivia/audiotrivia.py b/audiotrivia/audiotrivia.py index 394e1d1..586f5b7 100644 --- a/audiotrivia/audiotrivia.py +++ b/audiotrivia/audiotrivia.py @@ -5,13 +5,15 @@ from typing import List import lavalink import yaml from redbot.cogs.audio import Audio +from redbot.cogs.audio.core.utilities import validation from redbot.cogs.trivia import LOG from redbot.cogs.trivia.trivia import InvalidListError, Trivia from redbot.core import commands, Config, checks from redbot.core.bot import Red from redbot.core.data_manager import cog_data_path from redbot.core.utils.chat_formatting import box -from redbot.cogs.audio.utils import userlimit +# from redbot.cogs.audio.utils import userlimit + from .audiosession import AudioSession @@ -106,7 +108,7 @@ class AudioTrivia(Trivia): try: if not ctx.author.voice.channel.permissions_for( ctx.me - ).connect or userlimit(ctx.author.voice.channel): + ).connect or self.audio.is_vc_full(ctx.author.voice.channel): return await ctx.send("I don't have permission to connect to your channel.") await lavalink.connect(ctx.author.voice.channel) lavaplayer = lavalink.get_player(ctx.guild.id) @@ -117,7 +119,7 @@ class AudioTrivia(Trivia): lavaplayer = lavalink.get_player(ctx.guild.id) lavaplayer.store("channel", ctx.channel.id) # What's this for? I dunno - await self.audio._data_check(ctx) + await self.audio.set_player_settings(ctx) if not ctx.author.voice or ctx.author.voice.channel != lavaplayer.channel: return await ctx.send( diff --git a/audiotrivia/data/lists/hockeygoalhorns.yaml b/audiotrivia/data/lists/hockeygoalhorns.yaml deleted file mode 100644 index dd825e8..0000000 --- a/audiotrivia/data/lists/hockeygoalhorns.yaml +++ /dev/null @@ -1,125 +0,0 @@ -AUTHOR: Lazar -https://www.youtube.com/watch?v=6OejNXrGkK0&list=PLEfKMmYWy5LTPwexaHOaPeYBne8j7udRq: -- Anaheim -- Ducks -- Anaheim Ducks -https://www.youtube.com/watch?v=RbUxSPoU9Yg&list=PLEfKMmYWy5LTPwexaHOaPeYBne8j7udRq&index=2: -- Arizona -- Coyotes -- Arizona Coyotes -https://www.youtube.com/watch?v=DsI0PgWADks&list=PLEfKMmYWy5LTPwexaHOaPeYBne8j7udRq&index=4: -- Boston -- Bruins -- Boston Bruins -https://www.youtube.com/watch?v=hjFTd3MJOHc&list=PLEfKMmYWy5LTPwexaHOaPeYBne8j7udRq&index=5: -- Buffalo -- Sabres -- Buffalo Sabres -https://www.youtube.com/watch?v=sn1PliBCRDY&list=PLEfKMmYWy5LTPwexaHOaPeYBne8j7udRq&index=6: -- Calgary -- Flames -- Calgary Flames -https://www.youtube.com/watch?v=3exZm6Frd18&list=PLEfKMmYWy5LTPwexaHOaPeYBne8j7udRq&index=7: -- Carolina -- Hurricanes -- Carolina Hurricanes -https://www.youtube.com/watch?v=sBeXPMkqR80&list=PLEfKMmYWy5LTPwexaHOaPeYBne8j7udRq&index=8: -- Chicago -- Blackhawks -- Chicago Blackhawks -https://www.youtube.com/watch?v=MARxzs_vCPI&list=PLEfKMmYWy5LTPwexaHOaPeYBne8j7udRq&index=9: -- Colorado -- Avalanche -- Colorado Avalanche -https://www.youtube.com/watch?v=6yYbQfOWw4k&list=PLEfKMmYWy5LTPwexaHOaPeYBne8j7udRq&index=10: -- Columbus -- Blue Jackets -- Columbus Blue Jackets -https://www.youtube.com/watch?v=Af8_9NP5lyw&list=PLEfKMmYWy5LTPwexaHOaPeYBne8j7udRq&index=11: -- Dallas -- Stars -- Dallas Stars -https://www.youtube.com/watch?v=JflfvLvY7ks&list=PLEfKMmYWy5LTPwexaHOaPeYBne8j7udRq&index=13: -- Detroit -- Red wings -- Detroit Red Wings -https://www.youtube.com/watch?v=xc422k5Tcqc&list=PLEfKMmYWy5LTPwexaHOaPeYBne8j7udRq&index=15: -- Edmonton -- Oilers -- Edmonton Oilers -https://www.youtube.com/watch?v=Dm1bjUB9HLE&list=PLEfKMmYWy5LTPwexaHOaPeYBne8j7udRq&index=16: -- Florida -- Panthers -- Florida Panthers -https://www.youtube.com/watch?v=jSgd3aIepY4&list=PLEfKMmYWy5LTPwexaHOaPeYBne8j7udRq&index=17: -- Los Angeles -- Kings -- Los Angeles Kings -https://www.youtube.com/watch?v=4Pj8hWPR9VI&list=PLEfKMmYWy5LTPwexaHOaPeYBne8j7udRq&index=18: -- Minnesota -- Wild -- Minnesota Wild -https://www.youtube.com/watch?v=rRGlUFWEBMk&list=PLEfKMmYWy5LTPwexaHOaPeYBne8j7udRq&index=19: -- Montreal -- Canadiens -- Montreal Canadiens -https://www.youtube.com/watch?v=fHTehdlMwWQ&list=PLEfKMmYWy5LTPwexaHOaPeYBne8j7udRq&index=20: -- Nashville -- Predators -- Nashville Predators -https://www.youtube.com/watch?v=4q0eNg-AbrQ&list=PLEfKMmYWy5LTPwexaHOaPeYBne8j7udRq&index=21: -- New Jersey -- Devils -- New Jersey Devils -https://www.youtube.com/watch?v=ZC514zGrL80&list=PLEfKMmYWy5LTPwexaHOaPeYBne8j7udRq&index=23: -- New York -- Islanders -- New York Islanders -https://www.youtube.com/watch?v=Zzfks2A2n38&list=PLEfKMmYWy5LTPwexaHOaPeYBne8j7udRq&index=24: -- New York -- Rangers -- New York Rangers -https://www.youtube.com/watch?v=fHlWxPRNVBc&list=PLEfKMmYWy5LTPwexaHOaPeYBne8j7udRq&index=25: -- Ottawa -- Senators -- Ottawa Senators -https://www.youtube.com/watch?v=0LsXpMiVD1E&list=PLEfKMmYWy5LTPwexaHOaPeYBne8j7udRq&index=26: -- Philadelphia -- Flyers -- Philadelphia Flyers -https://www.youtube.com/watch?v=Llw3adcNuzI&list=PLEfKMmYWy5LTPwexaHOaPeYBne8j7udRq&index=27: -- Pittsburgh -- Penguins -- Pittsburgh Penguins -https://www.youtube.com/watch?v=NZqSBkmpbLw&list=PLEfKMmYWy5LTPwexaHOaPeYBne8j7udRq&index=28: -- San Jose -- Sharks -- San Jose Sharks -https://www.youtube.com/watch?v=Q23TDOJsY1s&list=PLEfKMmYWy5LTPwexaHOaPeYBne8j7udRq&index=29: -- St. Louis -- Blues -- St. Louis Blues -https://www.youtube.com/watch?v=bdhDXxM20iM&list=PLEfKMmYWy5LTPwexaHOaPeYBne8j7udRq&index=30: -- Tampa Bay -- Lightning -- Tampa Bay Lightning -https://www.youtube.com/watch?v=2cyekaemZgs&list=PLEfKMmYWy5LTPwexaHOaPeYBne8j7udRq&index=31: -- Toronto -- Maple Leafs -- Toronto Maple Leafs -https://www.youtube.com/watch?v=CPozN-ZHpAo&list=PLEfKMmYWy5LTPwexaHOaPeYBne8j7udRq&index=32: -- Vancouver -- Canucks -- Vancouver Canucks -https://www.youtube.com/watch?v=zheGI316WXg&list=PLEfKMmYWy5LTPwexaHOaPeYBne8j7udRq&index=33: -- Vegas -- Golden Knights -- Vegas Golden Knights -https://www.youtube.com/watch?v=BH_CC1RxtfU&list=PLEfKMmYWy5LTPwexaHOaPeYBne8j7udRq&index=34: -- Washington -- Capitals -- Washington Capitals -https://www.youtube.com/watch?v=3gcahU_i9WE&list=PLEfKMmYWy5LTPwexaHOaPeYBne8j7udRq&index=35: -- Winnipeg -- Jets -- Winnipeg Jets diff --git a/audiotrivia/data/lists/nhlgoalhorns.yaml b/audiotrivia/data/lists/nhlgoalhorns.yaml new file mode 100644 index 0000000..4dd28ac --- /dev/null +++ b/audiotrivia/data/lists/nhlgoalhorns.yaml @@ -0,0 +1,125 @@ +AUTHOR: Lazar +https://youtu.be/6OejNXrGkK0: +- Anaheim +- Ducks +- Anaheim Ducks +https://youtu.be/RbUxSPoU9Yg: +- Arizona +- Coyotes +- Arizona Coyotes +https://youtu.be/DsI0PgWADks: +- Boston +- Bruins +- Boston Bruins +https://youtu.be/hjFTd3MJOHc: +- Buffalo +- Sabres +- Buffalo Sabres +https://youtu.be/sn1PliBCRDY: +- Calgary +- Flames +- Calgary Flames +https://youtu.be/3exZm6Frd18: +- Carolina +- Hurricanes +- Carolina Hurricanes +https://youtu.be/sBeXPMkqR80: +- Chicago +- Blackhawks +- Chicago Blackhawks +https://youtu.be/MARxzs_vCPI: +- Colorado +- Avalanche +- Colorado Avalanche +https://youtu.be/6yYbQfOWw4k: +- Columbus +- Blue Jackets +- Columbus Blue Jackets +https://youtu.be/Af8_9NP5lyw: +- Dallas +- Stars +- Dallas Stars +https://youtu.be/JflfvLvY7ks: +- Detroit +- Red wings +- Detroit Red Wings +https://youtu.be/xc422k5Tcqc: +- Edmonton +- Oilers +- Edmonton Oilers +https://youtu.be/Dm1bjUB9HLE: +- Florida +- Panthers +- Florida Panthers +https://youtu.be/jSgd3aIepY4: +- Los Angeles +- Kings +- Los Angeles Kings +https://youtu.be/4Pj8hWPR9VI: +- Minnesota +- Wild +- Minnesota Wild +https://youtu.be/rRGlUFWEBMk: +- Montreal +- Canadiens +- Montreal Canadiens +https://youtu.be/fHTehdlMwWQ: +- Nashville +- Predators +- Nashville Predators +https://youtu.be/4q0eNg-AbrQ: +- New Jersey +- Devils +- New Jersey Devils +https://youtu.be/ZC514zGrL80: +- New York +- Islanders +- New York Islanders +https://youtu.be/Zzfks2A2n38: +- New York +- Rangers +- New York Rangers +https://youtu.be/fHlWxPRNVBc: +- Ottawa +- Senators +- Ottawa Senators +https://youtu.be/0LsXpMiVD1E: +- Philadelphia +- Flyers +- Philadelphia Flyers +https://youtu.be/Llw3adcNuzI: +- Pittsburgh +- Penguins +- Pittsburgh Penguins +https://youtu.be/NZqSBkmpbLw: +- San Jose +- Sharks +- San Jose Sharks +https://youtu.be/Q23TDOJsY1s: +- St. Louis +- Blues +- St. Louis Blues +https://youtu.be/bdhDXxM20iM: +- Tampa Bay +- Lightning +- Tampa Bay Lightning +https://youtu.be/2cyekaemZgs: +- Toronto +- Maple Leafs +- Toronto Maple Leafs +https://youtu.be/CPozN-ZHpAo: +- Vancouver +- Canucks +- Vancouver Canucks +https://youtu.be/zheGI316WXg: +- Vegas +- Golden Knights +- Vegas Golden Knights +https://youtu.be/BH_CC1RxtfU: +- Washington +- Capitals +- Washington Capitals +https://youtu.be/3gcahU_i9WE: +- Winnipeg +- Jets +- Winnipeg Jets From 62215ab4bab24714de228afcc746af8b51d402bb Mon Sep 17 00:00:00 2001 From: bobloy <alboblexloy@gmail.com> Date: Fri, 29 May 2020 11:37:37 -0400 Subject: [PATCH 3/7] Full names --- audiotrivia/data/lists/nhlgoalhorns.yaml | 56 ++++++++++++------------ 1 file changed, 28 insertions(+), 28 deletions(-) diff --git a/audiotrivia/data/lists/nhlgoalhorns.yaml b/audiotrivia/data/lists/nhlgoalhorns.yaml index 4dd28ac..689f478 100644 --- a/audiotrivia/data/lists/nhlgoalhorns.yaml +++ b/audiotrivia/data/lists/nhlgoalhorns.yaml @@ -1,125 +1,125 @@ AUTHOR: Lazar https://youtu.be/6OejNXrGkK0: +- Anaheim Ducks - Anaheim - Ducks -- Anaheim Ducks https://youtu.be/RbUxSPoU9Yg: +- Arizona Coyotes - Arizona - Coyotes -- Arizona Coyotes https://youtu.be/DsI0PgWADks: +- Boston Bruins - Boston - Bruins -- Boston Bruins https://youtu.be/hjFTd3MJOHc: +- Buffalo Sabres - Buffalo - Sabres -- Buffalo Sabres https://youtu.be/sn1PliBCRDY: +- Calgary Flames - Calgary - Flames -- Calgary Flames https://youtu.be/3exZm6Frd18: +- Carolina Hurricanes - Carolina - Hurricanes -- Carolina Hurricanes https://youtu.be/sBeXPMkqR80: +- Chicago Blackhawks - Chicago - Blackhawks -- Chicago Blackhawks https://youtu.be/MARxzs_vCPI: +- Colorado Avalanche - Colorado - Avalanche -- Colorado Avalanche https://youtu.be/6yYbQfOWw4k: +- Columbus Blue Jackets - Columbus - Blue Jackets -- Columbus Blue Jackets https://youtu.be/Af8_9NP5lyw: - Dallas - Stars - Dallas Stars https://youtu.be/JflfvLvY7ks: +- Detroit Red Wings - Detroit - Red wings -- Detroit Red Wings https://youtu.be/xc422k5Tcqc: +- Edmonton Oilers - Edmonton - Oilers -- Edmonton Oilers https://youtu.be/Dm1bjUB9HLE: +- Florida Panthers - Florida - Panthers -- Florida Panthers https://youtu.be/jSgd3aIepY4: +- Los Angeles Kings - Los Angeles - Kings -- Los Angeles Kings https://youtu.be/4Pj8hWPR9VI: +- Minnesota Wild - Minnesota - Wild -- Minnesota Wild https://youtu.be/rRGlUFWEBMk: +- Montreal Canadiens - Montreal - Canadiens -- Montreal Canadiens https://youtu.be/fHTehdlMwWQ: +- Nashville Predators - Nashville - Predators -- Nashville Predators https://youtu.be/4q0eNg-AbrQ: +- New Jersey Devils - New Jersey - Devils -- New Jersey Devils https://youtu.be/ZC514zGrL80: - New York - Islanders - New York Islanders https://youtu.be/Zzfks2A2n38: +- New York Rangers - New York - Rangers -- New York Rangers https://youtu.be/fHlWxPRNVBc: +- Ottawa Senators - Ottawa - Senators -- Ottawa Senators https://youtu.be/0LsXpMiVD1E: +- Philadelphia Flyers - Philadelphia - Flyers -- Philadelphia Flyers https://youtu.be/Llw3adcNuzI: +- Pittsburgh Penguins - Pittsburgh - Penguins -- Pittsburgh Penguins https://youtu.be/NZqSBkmpbLw: +- San Jose Sharks - San Jose - Sharks -- San Jose Sharks https://youtu.be/Q23TDOJsY1s: +- St. Louis Blues - St. Louis - Blues -- St. Louis Blues https://youtu.be/bdhDXxM20iM: +- Tampa Bay Lightning - Tampa Bay - Lightning -- Tampa Bay Lightning https://youtu.be/2cyekaemZgs: +- Toronto Maple Leafs - Toronto - Maple Leafs -- Toronto Maple Leafs https://youtu.be/CPozN-ZHpAo: - Vancouver - Canucks - Vancouver Canucks https://youtu.be/zheGI316WXg: +- Vegas Golden Knights - Vegas - Golden Knights -- Vegas Golden Knights https://youtu.be/BH_CC1RxtfU: +- Washington Capitals - Washington - Capitals -- Washington Capitals https://youtu.be/3gcahU_i9WE: +- Winnipeg Jets - Winnipeg - Jets -- Winnipeg Jets From a8ebe7eb97dc2b643a0174b6b55142d2bc768ad6 Mon Sep 17 00:00:00 2001 From: bobloy <alboblexloy@gmail.com> Date: Fri, 19 Jun 2020 07:37:08 -0400 Subject: [PATCH 4/7] double e extension --- qrinvite/qrinvite.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/qrinvite/qrinvite.py b/qrinvite/qrinvite.py index 0960c14..cef82e1 100644 --- a/qrinvite/qrinvite.py +++ b/qrinvite/qrinvite.py @@ -60,7 +60,7 @@ class QRInvite(Cog): ) return - eextention = pathlib.Path(image_url).parts[-1].replace(".", "?").split("?")[1] + extension = pathlib.Path(image_url).parts[-1].replace(".", "?").split("?")[1] path: pathlib.Path = cog_data_path(self) image_path = path / (ctx.guild.icon + "." + extension) From 7e66ed49174da7a9f052504e038df88ce72134d3 Mon Sep 17 00:00:00 2001 From: bobloy <alboblexloy@gmail.com> Date: Tue, 23 Jun 2020 12:57:32 -0400 Subject: [PATCH 5/7] Handle other file extensions for now --- qrinvite/qrinvite.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/qrinvite/qrinvite.py b/qrinvite/qrinvite.py index cef82e1..67d895b 100644 --- a/qrinvite/qrinvite.py +++ b/qrinvite/qrinvite.py @@ -72,9 +72,15 @@ class QRInvite(Cog): file.write(image) if extension == "webp": - new_path = convert_png(str(image_path)) - else: + new_path = convert_webp_to_png(str(image_path)) + elif extension == "gif": + await ctx.send("gif is not supported yet, stay tuned") + return + elif extension == "png": new_path = str(image_path) + else: + await ctx.send(f"{extension} is not supported yet, stay tuned") + return myqr.run( invite, @@ -89,7 +95,7 @@ class QRInvite(Cog): await ctx.send(file=discord.File(png_fp.read(), "qrcode.png")) -def convert_png(path): +def convert_webp_to_png(path): im = Image.open(path) im.load() alpha = im.split()[-1] From 4844820785ca2f231708c7d40011129edd649be2 Mon Sep 17 00:00:00 2001 From: DannyDB5544 <59149717+DannyDB5544@users.noreply.github.com> Date: Tue, 14 Jul 2020 14:09:48 +0100 Subject: [PATCH 6/7] It'd be smart if i corrected the help page, eh? (#96) --- scp/scp.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scp/scp.py b/scp/scp.py index 9827dad..7ffba0c 100644 --- a/scp/scp.py +++ b/scp/scp.py @@ -25,7 +25,7 @@ class SCP(Cog): msg = "http://www.scp-wiki.net/scp-{:03}".format(num) c = discord.Color.green() else: - msg = "You must specify a number between 1 and 4999." + msg = "You must specify a number between 1 and 5999." c = discord.Color.red() if await ctx.embed_requested(): From 6cc5162f56a1ecbe5ddf914196ca5da78f4d5c0a Mon Sep 17 00:00:00 2001 From: bobloy <alboblexloy@gmail.com> Date: Mon, 20 Jul 2020 14:31:26 -0400 Subject: [PATCH 7/7] Use more built-in functions, switch to on_command_error to save on processing power (#97) --- ccrole/ccrole.py | 93 ++++++++++++++++++++++++++++++++++++------------ 1 file changed, 70 insertions(+), 23 deletions(-) diff --git a/ccrole/ccrole.py b/ccrole/ccrole.py index 3f3be5e..2d662d3 100644 --- a/ccrole/ccrole.py +++ b/ccrole/ccrole.py @@ -1,10 +1,13 @@ import asyncio +import json import re from typing import Any import discord +from discord.ext.commands.view import StringView from redbot.core import Config, checks from redbot.core import commands +from redbot.core.bot import Red from redbot.core.utils.chat_formatting import pagify, box Cog: Any = getattr(commands, "Cog", object) @@ -16,7 +19,7 @@ class CCRole(Cog): Creates commands used to display text and adjust roles """ - def __init__(self, bot): + def __init__(self, bot: Red): self.bot = bot self.config = Config.get_conf(self, identifier=9999114111108101) default_guild = {"cmdlist": {}, "settings": {}} @@ -115,9 +118,7 @@ class CCRole(Cog): return # Selfrole - await ctx.send( - "Is this a targeted command?(yes/no)\nNo will make this a selfrole command" - ) + await ctx.send("Is this a targeted command?(yes/no)\nNo will make this a selfrole command") try: answer = await self.bot.wait_for("message", timeout=120, check=check) @@ -235,24 +236,41 @@ class CCRole(Cog): for page in pagify(cmd_list, delims=[" ", "\n"]): await ctx.author.send(box(page)) await ctx.send("Command list DM'd") - - @commands.Cog.listener() - async def on_message(self, message): - if len(message.content) < 2 or message.guild is None: - return - guild = message.guild - try: - prefix = await self.get_prefix(message) - except ValueError: - return + @commands.Cog.listener() + async def on_command_error(self, ctx: commands.Context, exception): + cmd = ctx.invoked_with + guild = ctx.guild + message = ctx.message cmdlist = self.config.guild(guild).cmdlist - cmd = message.content[len(prefix) :].split()[0].lower() + # cmd = message.content[len(prefix) :].split()[0].lower() cmd = await cmdlist.get_raw(cmd, default=None) if cmd is not None: - await self.eval_cc(cmd, message) + await self.eval_cc(cmd, message, ctx) + + # @commands.Cog.listener() + # async def on_message(self, message: discord.Message): + # if len(message.content) < 2 or message.guild is None: + # return + # + # ctx: commands.Context = await self.bot.get_context(message) + # cmd = ctx.invoked_with + # guild = message.guild + # # try: + # # prefix = await self.get_prefix(message) + # # except ValueError: + # # return + # + # # prefix = ctx.prefix + # + # cmdlist = self.config.guild(guild).cmdlist + # # cmd = message.content[len(prefix) :].split()[0].lower() + # cmd = await cmdlist.get_raw(cmd, default=None) + # + # if cmd is not None: + # await self.eval_cc(cmd, message, ctx) async def _get_roles_from_content(self, ctx, content): content_list = content.split(",") @@ -284,7 +302,7 @@ class CCRole(Cog): return p raise ValueError - async def eval_cc(self, cmd, message): + async def eval_cc(self, cmd, message, ctx): """Does all the work""" if cmd["proles"] and not ( set(role.id for role in message.author.roles) & set(cmd["proles"]) @@ -292,16 +310,45 @@ class CCRole(Cog): return # Not authorized, do nothing if cmd["targeted"]: - try: - target = discord.utils.get( - message.guild.members, mention=message.content.split(maxsplit=1)[1] - ) - except IndexError: # .split() return list of len<2 + # try: + # arg1 = message.content.split(maxsplit=1)[1] + # except IndexError: # .split() return list of len<2 + # target = None + # else: + # target = discord.utils.get( + # message.guild.members, mention=arg1 + # ) + + view: StringView = ctx.view + view.skip_ws() + + guild: discord.Guild = ctx.guild + # print(f"Guild: {guild}") + + target = view.get_quoted_word() + # print(f"Target: {target}") + + if target: + # target = discord.utils.get(guild.members, mention=target) + try: + target = await commands.MemberConverter().convert(ctx, target) + except commands.BadArgument: + target = None + else: target = None + # try: + # arg1 = ctx.args[1] + # except IndexError: # args is list of len<2 + # target = None + # else: + # target = discord.utils.get( + # message.guild.members, mention=arg1 + # ) + if not target: out_message = "This custom command is targeted! @mention a target\n`{} <target>`".format( - message.content.split()[0] + ctx.invoked_with ) await message.channel.send(out_message) return