Merge pull request #9 from bobloy/tts-develop

tts-develop
pull/10/head
bobloy 7 years ago committed by GitHub
commit 19de2e2e2d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -19,6 +19,7 @@ Cog Function
| secrethitler | **Incomplete** | <details><summary>Play the Secret Hitler game</summary>Concept, no work done yet</details> | | secrethitler | **Incomplete** | <details><summary>Play the Secret Hitler game</summary>Concept, no work done yet</details> |
| stealemoji | **Alpha** | <details><summary>Steals any custom emoji it sees in a reaction</summary>Some planned upgrades for server generation</details> | | stealemoji | **Alpha** | <details><summary>Steals any custom emoji it sees in a reaction</summary>Some planned upgrades for server generation</details> |
| timerole | **Alpha** | <details><summary>Add roles to members after specified time on the server</summary>Upgraded from V2, please report any bugs</details> | | timerole | **Alpha** | <details><summary>Add roles to members after specified time on the server</summary>Upgraded from V2, please report any bugs</details> |
| tts | **Alpha** | <details><summary>Send a Text-to-Speech message as an uploaded mp3</summary>Initial release, please report any bugs</details> |
| werewolf | **Alpha** | <details><summary>Play the classic party game Werewolf within discord</summary>Another massive project currently being developed, will be fully customizable</details> | | werewolf | **Alpha** | <details><summary>Play the classic party game Werewolf within discord</summary>Another massive project currently being developed, will be fully customizable</details> |

@ -0,0 +1,5 @@
from .tts import TTS
def setup(bot):
bot.add_cog(TTS(bot))

@ -0,0 +1,22 @@
{
"author": [
"Bobloy"
],
"bot_version": [
3,
0,
0
],
"description": "Send Text2Speech messages as an uploaded mp3",
"hidden": true,
"install_msg": "Thank you for installing TTS. Get started with `[p]tts`",
"requirements": [
"gTTS"
],
"short": "Send TTS messages as uploaded mp3",
"tags": [
"bobloy",
"utils",
"audio"
]
}

@ -0,0 +1,34 @@
import io
import discord
from gtts import gTTS
from redbot.core import Config, commands
from redbot.core.bot import Red
class TTS:
"""
V3 Cog Template
"""
def __init__(self, bot: Red):
self.bot = bot
self.config = Config.get_conf(self, identifier=9811198108111121, force_registration=True)
default_global = {}
default_guild = {}
self.config.register_global(**default_global)
self.config.register_guild(**default_guild)
@commands.command(aliases=["t2s", "text2"])
async def tts(self, ctx: commands.Context, *, text: str):
"""
My custom cog
Extra information goes here
"""
mp3_fp = io.BytesIO()
tts = gTTS(text, 'en')
tts.write_to_fp(mp3_fp)
await ctx.send(file=discord.File(mp3_fp.getvalue(), "text.mp3"))
Loading…
Cancel
Save