1
Fork 0
mirror of https://github.com/RYGhub/royalnet.git synced 2024-11-23 19:44:20 +00:00

Merge more things

This commit is contained in:
Steffo 2019-10-09 01:18:09 +02:00
parent a69cb05bd1
commit 0ee9f12d8a
4 changed files with 12 additions and 9 deletions

View file

@ -69,8 +69,9 @@ class DiscordBot(GenericBot):
async def vc_connect_or_move(cli, channel: discord.VoiceChannel): async def vc_connect_or_move(cli, channel: discord.VoiceChannel):
# Connect to voice chat # Connect to voice chat
try: try:
await channel.connect()
log.debug(f"Connecting to Voice in {channel}") log.debug(f"Connecting to Voice in {channel}")
await channel.connect()
log.debug(f"Connected to Voice in {channel}")
except discord.errors.ClientException: except discord.errors.ClientException:
# Move to the selected channel, instead of connecting # Move to the selected channel, instead of connecting
# noinspection PyUnusedLocal # noinspection PyUnusedLocal
@ -119,12 +120,12 @@ class DiscordBot(GenericBot):
try: try:
await command.run(CommandArgs(parameters), data) await command.run(CommandArgs(parameters), data)
except InvalidInputError as e: except InvalidInputError as e:
await data.reply(f"⚠️ {e.message}\n" await data.reply(f":warning: {e.message}\n"
f"Syntax: [c]/{command.name} {command.syntax}[/c]") f"Syntax: [c]/{command.name} {command.syntax}[/c]")
except UnsupportedError as e: except UnsupportedError as e:
await data.reply(f"⚠️ {e.message}") await data.reply(f":warning: {e.message}")
except CommandError as e: except CommandError as e:
await data.reply(f"⚠️ {e.message}") await data.reply(f":warning: {e.message}")
except Exception as e: except Exception as e:
sentry_sdk.capture_exception(e) sentry_sdk.capture_exception(e)
error_message = f"🦀 [b]{e.__class__.__name__}[/b] 🦀\n" error_message = f"🦀 [b]{e.__class__.__name__}[/b] 🦀\n"

View file

@ -7,7 +7,6 @@ from .ciaoruozi import CiaoruoziCommand
from .color import ColorCommand from .color import ColorCommand
from .cv import CvCommand from .cv import CvCommand
from .diario import DiarioCommand from .diario import DiarioCommand
from .mp3 import Mp3Command
from .ping import PingCommand from .ping import PingCommand
from .rage import RageCommand from .rage import RageCommand
from .reminder import ReminderCommand from .reminder import ReminderCommand
@ -18,7 +17,6 @@ from .dnditem import DnditemCommand
from .dndspell import DndspellCommand from .dndspell import DndspellCommand
from .trivia import TriviaCommand from .trivia import TriviaCommand
from .mm import MmCommand from .mm import MmCommand
from .zawarudo import ZawarudoCommand
commands = [ commands = [
@ -26,7 +24,6 @@ commands = [
ColorCommand, ColorCommand,
CvCommand, CvCommand,
DiarioCommand, DiarioCommand,
Mp3Command,
PingCommand, PingCommand,
RageCommand, RageCommand,
ReminderCommand, ReminderCommand,
@ -37,7 +34,6 @@ commands = [
DndspellCommand, DndspellCommand,
TriviaCommand, TriviaCommand,
MmCommand, MmCommand,
ZawarudoCommand
] ]

View file

@ -9,6 +9,9 @@ from .playmode import PlaymodeCommand
from .queue import QueueCommand from .queue import QueueCommand
from .skip import SkipCommand from .skip import SkipCommand
from .summon import SummonCommand from .summon import SummonCommand
from .youtube import YoutubeCommand
from .soundcloud import SoundcloudCommand
from .zawarudo import ZawarudoCommand
commands = [ commands = [
@ -18,6 +21,9 @@ commands = [
QueueCommand, QueueCommand,
SkipCommand, SkipCommand,
SummonCommand, SummonCommand,
YoutubeCommand,
SoundcloudCommand,
ZawarudoCommand
] ]

View file

@ -68,7 +68,7 @@ class SoundcloudCommand(Command):
async def run(self, args: CommandArgs, data: CommandData) -> None: async def run(self, args: CommandArgs, data: CommandData) -> None:
guild_name, search = args.match(r"(?:\[(.+)])?\s*<?(.+)>?") guild_name, search = args.match(r"(?:\[(.+)])?\s*<?(.+)>?")
if search.startswith("http://") or search.startswith("https://"): if search.startswith("http://") or search.startswith("https://"):
raise CommandError("YoutubeCommand only accepts search queries, and you've sent an URL.\n" raise CommandError("SoundcloudCommand only accepts search queries, and you've sent an URL.\n"
"If you want to add a song from an url, please use PlayCommand!") "If you want to add a song from an url, please use PlayCommand!")
response = await self.interface.net_request(Request("music_soundcloud", {"search": search, response = await self.interface.net_request(Request("music_soundcloud", {"search": search,
"guild_name": guild_name}), "guild_name": guild_name}),