Merge branch 'master' into infochannel-develop
This commit is contained in:
commit
dd01d1e4cb
@ -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(
|
||||
|
125
audiotrivia/data/lists/nhlgoalhorns.yaml
Normal file
125
audiotrivia/data/lists/nhlgoalhorns.yaml
Normal file
@ -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
|
@ -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
|
||||
|
@ -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)
|
||||
@ -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]
|
||||
|
@ -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():
|
||||
|
Loading…
x
Reference in New Issue
Block a user