Giter Club home page Giter Club logo

lyrebot's People

Contributors

martinhowarth avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

lyrebot's Issues

Avoid copy-pasting URL by hosting local server

I noticed this bot relies on the user copy-pasting the authentication URL to Discord.

This is a great method to avoid the agony of hosting a server, so ignore this issue if you are happy with the current implementation.

I am working on a bot inspired by this one, written in JavaScript. I was initially using the same method. However, it felt quite hacky and prone to errors.

I wanted to recommend the option of hosting a local server, then reading the parameters req.query.code and req.query.state. This allows the user to immediately authenticate without copy-pasting.

Sorry if I'm being a nuisance. I've just been playing around with the API and I feel this is quite a clean and secure method.

(Note that this method requires OAuth 2.0 Authorization code Flow, so it does not work with #1)

NoneType error

I'm getting this error:

Ignoring exception in on_message
Traceback (most recent call last):
  File "C:\Users\Stijn\Anaconda3\lib\site-packages\discord.py-1.2.3-py3.7.egg\discord\client.py", line 270, in _run_event
    await coro(*args, **kwargs)
  File "C:\Users\Stijn\Anaconda3\lib\site-packages\lyrebot-0.1.0-py3.7.egg\lyrebot\discord_bot.py", line 189, in on_message
    message.author.voice.channel is not None,
AttributeError: 'NoneType' object has no attribute 'channel'

How to fix that?

HTTPError: 400 Client Error: Bad Request for url: https://avatar.lyrebird.ai/api/v0/generate

I don't know if this is a known issue or I'm just doing something wrong. But I get this error every time I try to make this bot use the API. It prints out this:

2019-07-06 07:56:53,377 - discord_bot - ERROR - command_error: <discord.ext.commands.context.Context object at 0x0000021EF61CF4A8>; Command raised an exception: HTTPError: 400 Client Error: Bad Request for url: https://avatar.lyrebird.ai/api/v0/generate
Ignoring exception in command speak:
Traceback (most recent call last):
File "C:\Users\Meow\AppData\Local\Programs\Python\Python36\lib\site-packages\discord\ext\commands\core.py", line 63, in wrapped
ret = await coro(*args, **kwargs)
File "D:\Desktop\lyrebot-master\lyrebot\discord_bot.py", line 162, in speak
await self.speak_aloud(ctx.message, *words)
File "D:\Desktop\lyrebot-master\lyrebot\discord_bot.py", line 135, in speak_aloud
sentence, self.lyrebird_tokens[ident])
File "D:\Desktop\lyrebot-master\lyrebot\lyrebird.py", line 72, in generate_voice_for_text
result.raise_for_status()
File "C:\Users\Meow\AppData\Local\Programs\Python\Python36\lib\site-packages\requests\models.py", line 940, in raise_for_status
raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 400 Client Error: Bad Request for url: https://avatar.lyrebird.ai/api/v0/generate

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "C:\Users\Meow\AppData\Local\Programs\Python\Python36\lib\site-packages\discord\ext\commands\bot.py", line 860, in invoke
await ctx.command.invoke(ctx)
File "C:\Users\Meow\AppData\Local\Programs\Python\Python36\lib\site-packages\discord\ext\commands\core.py", line 698, in invoke
await injected(*ctx.args, **ctx.kwargs)
File "C:\Users\Meow\AppData\Local\Programs\Python\Python36\lib\site-packages\discord\ext\commands\core.py", line 72, in wrapped
raise CommandInvokeError(exc) from exc
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: HTTPError: 400 Client Error: Bad Request for url: https://avatar.lyrebird.ai/api/v0/generate

I don't know if I'm doing something wrong or what. But for whatever reason, I can't get it to speak.

Bypass requesting a token by using OAuth 2.0 Implicit Flow

I noticed this bot requests to avatar.lyrebird.ai/api/v0/token on lines 18 to 29.

This step is unnecessary if myvoice.lyrebird.ai/authorize is called with response_type as token. This is described in the documentation as "OAuth 2.0 Implicit Flow".

The functionality is almost identical as the user has to copy the URL either way, so I believe it would be a good way to remove one unnecessary request.

(Note that this method requires OAuth 2.0 Implicit Flow, so it does not work with #4)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.