Adding tiktok cause i hate my life
This commit is contained in:
parent
9b4fe77f1f
commit
6aff23ac18
@ -4,6 +4,7 @@ import core_utils
|
|||||||
import discord
|
import discord
|
||||||
import random
|
import random
|
||||||
import requests
|
import requests
|
||||||
|
import os
|
||||||
|
|
||||||
|
|
||||||
class Cheeky(commands.Cog):
|
class Cheeky(commands.Cog):
|
||||||
@ -151,14 +152,51 @@ class Cheeky(commands.Cog):
|
|||||||
"https://paypal.me/ldooks\nhttps://venmo.com/ldooks\nhttps://cash.me/$ldooks"
|
"https://paypal.me/ldooks\nhttps://venmo.com/ldooks\nhttps://cash.me/$ldooks"
|
||||||
)
|
)
|
||||||
|
|
||||||
@commands.command(name="nft")
|
@commands.slash_command(
|
||||||
|
guild_ids=None,
|
||||||
|
name="tiktok",
|
||||||
|
description="Returns a god awful tts with the tiktok voice",
|
||||||
|
)
|
||||||
|
@option(name="input", required=True, description="The text you want as TTS")
|
||||||
|
async def tiktok(self, ctx: commands.Context, input):
|
||||||
|
|
||||||
|
import tempfile
|
||||||
|
import base64
|
||||||
|
|
||||||
|
file, file_path = tempfile.mkstemp()
|
||||||
|
|
||||||
|
headers = {
|
||||||
|
"Content-Type": "application/json",
|
||||||
|
}
|
||||||
|
|
||||||
|
json_data = {
|
||||||
|
"text": input,
|
||||||
|
"voice": "en_us_001",
|
||||||
|
}
|
||||||
|
|
||||||
|
response = requests.post(
|
||||||
|
"https://tiktok-tts.weilnet.workers.dev/api/generation",
|
||||||
|
headers=headers,
|
||||||
|
json=json_data,
|
||||||
|
).json()
|
||||||
|
|
||||||
|
audio_file = base64.b64decode(response["data"])
|
||||||
|
with open(file_path, "wb") as f:
|
||||||
|
f.write(audio_file)
|
||||||
|
f.close()
|
||||||
|
os.rename(file_path, file_path + ".mp3")
|
||||||
|
|
||||||
|
await ctx.respond(file=discord.File(file_path + ".mp3"))
|
||||||
|
os.remove(file_path + ".mp3")
|
||||||
|
|
||||||
|
@commands.slash_command(guild_ids=None, name="nft", description="Returns an nft")
|
||||||
async def nft(self, ctx: commands.Context):
|
async def nft(self, ctx: commands.Context):
|
||||||
|
|
||||||
import nft
|
import nft
|
||||||
|
|
||||||
result = nft.get_nft()
|
result = nft.get_nft()
|
||||||
|
|
||||||
await ctx.reply(result)
|
await ctx.respond(result)
|
||||||
|
|
||||||
@commands.slash_command(
|
@commands.slash_command(
|
||||||
guild_ids=None, name="8ball", description="Ask the magic 8 ball a question"
|
guild_ids=None, name="8ball", description="Ask the magic 8 ball a question"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user