martinhowarth / lyrebot Goto Github PK
View Code? Open in Web Editor NEWA discord bot that speaks what you type in your own voice.
License: MIT License
A discord bot that speaks what you type in your own voice.
License: MIT License
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)
Current master only works against <v1.0.0 of discord.py.
Work in progress...
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?
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/generateThe 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.
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)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.