mirror of
https://github.com/Cog-Creators/Red-DiscordBot.git
synced 2025-11-21 18:27:59 -05:00
[V3] add a script for regenerating all strings (#1318)
* [V3] add a script for regenerating all strings * Edits to the yml files * Fix up deploy section * Make generate_strings upload to Crowdin
This commit is contained in:
@@ -4,6 +4,10 @@ import os
|
||||
import youtube_dl
|
||||
import discord
|
||||
|
||||
from redbot.core.i18n import CogI18n
|
||||
|
||||
_ = CogI18n("Audio", __file__)
|
||||
|
||||
|
||||
# Just a little experimental audio cog not meant for final release
|
||||
|
||||
@@ -18,7 +22,7 @@ class Audio:
|
||||
async def local(self, ctx, *, filename: str):
|
||||
"""Play mp3"""
|
||||
if ctx.author.voice is None:
|
||||
await ctx.send("Join a voice channel first!")
|
||||
await ctx.send(_("Join a voice channel first!"))
|
||||
return
|
||||
|
||||
if ctx.voice_client:
|
||||
@@ -26,22 +30,22 @@ class Audio:
|
||||
await ctx.voice_client.disconnect()
|
||||
path = os.path.join("cogs", "audio", "songs", filename + ".mp3")
|
||||
if not os.path.isfile(path):
|
||||
await ctx.send("Let's play a file that exists pls")
|
||||
await ctx.send(_("Let's play a file that exists pls"))
|
||||
return
|
||||
player = PCMVolumeTransformer(FFmpegPCMAudio(path), volume=1)
|
||||
voice = await ctx.author.voice.channel.connect()
|
||||
voice.play(player)
|
||||
await ctx.send("{} is playing a song...".format(ctx.author))
|
||||
await ctx.send(_("{} is playing a song...").format(ctx.author))
|
||||
|
||||
@commands.command()
|
||||
async def play(self, ctx, url: str):
|
||||
"""Play youtube url"""
|
||||
url = url.strip("<").strip(">")
|
||||
if ctx.author.voice is None:
|
||||
await ctx.send("Join a voice channel first!")
|
||||
await ctx.send(_("Join a voice channel first!"))
|
||||
return
|
||||
elif "youtube.com" not in url.lower():
|
||||
await ctx.send("Youtube links pls")
|
||||
await ctx.send(_("Youtube links pls"))
|
||||
return
|
||||
|
||||
if ctx.voice_client:
|
||||
@@ -51,7 +55,7 @@ class Audio:
|
||||
player = PCMVolumeTransformer(yt, volume=1)
|
||||
voice = await ctx.author.voice.channel.connect()
|
||||
voice.play(player)
|
||||
await ctx.send("{} is playing a song...".format(ctx.author))
|
||||
await ctx.send(_("{} is playing a song...").format(ctx.author))
|
||||
|
||||
@commands.command()
|
||||
async def stop(self, ctx):
|
||||
@@ -60,7 +64,7 @@ class Audio:
|
||||
ctx.voice_client.source.cleanup()
|
||||
await ctx.voice_client.disconnect()
|
||||
else:
|
||||
await ctx.send("I'm not even connected to a voice channel!", delete_after=2)
|
||||
await ctx.send(_("I'm not even connected to a voice channel!"), delete_after=2)
|
||||
await ctx.message.delete()
|
||||
|
||||
@commands.command()
|
||||
@@ -70,7 +74,7 @@ class Audio:
|
||||
ctx.voice_client.pause()
|
||||
await ctx.send("👌", delete_after=2)
|
||||
else:
|
||||
await ctx.send("I'm not even connected to a voice channel!", delete_after=2)
|
||||
await ctx.send(_("I'm not even connected to a voice channel!"), delete_after=2)
|
||||
await ctx.message.delete()
|
||||
|
||||
@commands.command()
|
||||
@@ -80,7 +84,7 @@ class Audio:
|
||||
ctx.voice_client.resume()
|
||||
await ctx.send("👌", delete_after=2)
|
||||
else:
|
||||
await ctx.send("I'm not even connected to a voice channel!", delete_after=2)
|
||||
await ctx.send(_("I'm not even connected to a voice channel!"), delete_after=2)
|
||||
await ctx.message.delete()
|
||||
|
||||
@commands.command(hidden=True)
|
||||
@@ -88,9 +92,9 @@ class Audio:
|
||||
"""Sets the volume"""
|
||||
if ctx.voice_client:
|
||||
ctx.voice_client.source.volume = n
|
||||
await ctx.send("Volume set.", delete_after=2)
|
||||
await ctx.send(_("Volume set."), delete_after=2)
|
||||
else:
|
||||
await ctx.send("I'm not even connected to a voice channel!", delete_after=2)
|
||||
await ctx.send(_("I'm not even connected to a voice channel!"), delete_after=2)
|
||||
await ctx.message.delete()
|
||||
|
||||
def __unload(self):
|
||||
|
||||
41
redbot/cogs/audio/locales/messages.pot
Normal file
41
redbot/cogs/audio/locales/messages.pot
Normal file
@@ -0,0 +1,41 @@
|
||||
# SOME DESCRIPTIVE TITLE.
|
||||
# Copyright (C) YEAR ORGANIZATION
|
||||
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
|
||||
#
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: PACKAGE VERSION\n"
|
||||
"POT-Creation-Date: 2018-02-18 14:42+AKST\n"
|
||||
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
||||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=CHARSET\n"
|
||||
"Content-Transfer-Encoding: ENCODING\n"
|
||||
"Generated-By: pygettext.py 1.5\n"
|
||||
|
||||
|
||||
#: ../audio.py:25 ../audio.py:45
|
||||
msgid "Join a voice channel first!"
|
||||
msgstr ""
|
||||
|
||||
#: ../audio.py:33
|
||||
msgid "Let's play a file that exists pls"
|
||||
msgstr ""
|
||||
|
||||
#: ../audio.py:38 ../audio.py:58
|
||||
msgid "{} is playing a song..."
|
||||
msgstr ""
|
||||
|
||||
#: ../audio.py:48
|
||||
msgid "Youtube links pls"
|
||||
msgstr ""
|
||||
|
||||
#: ../audio.py:67 ../audio.py:77 ../audio.py:87 ../audio.py:97
|
||||
msgid "I'm not even connected to a voice channel!"
|
||||
msgstr ""
|
||||
|
||||
#: ../audio.py:95
|
||||
msgid "Volume set."
|
||||
msgstr ""
|
||||
|
||||
15
redbot/cogs/audio/locales/regen_messages.py
Normal file
15
redbot/cogs/audio/locales/regen_messages.py
Normal file
@@ -0,0 +1,15 @@
|
||||
import subprocess
|
||||
|
||||
TO_TRANSLATE = [
|
||||
'../audio.py'
|
||||
]
|
||||
|
||||
|
||||
def regen_messages():
|
||||
subprocess.run(
|
||||
['pygettext', '-n'] + TO_TRANSLATE
|
||||
)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
regen_messages()
|
||||
Reference in New Issue
Block a user