bot.cogs package¶
Submodules¶
bot.cogs.commands module¶
-
class
bot.cogs.commands.
Kommandon
(bot)¶ Bases:
discord.ext.commands.cog.Cog
-
bot.cogs.commands.
setup
(bot)¶
bot.cogs.events module¶
bot.cogs.minecraft module¶
-
class
bot.cogs.minecraft.
Minecraft
(bot)¶ Bases:
discord.ext.commands.cog.Cog
-
bot.cogs.minecraft.
setup
(bot)¶
bot.cogs.music module¶
Copyright (c) 2019 Valentin B. A simple music bot written in discord.py using youtube-dl. Though it’s a simple example, music bots are complex and require much time and knowledge until they work perfectly. Use this as an example or a base for your own bot and extend it as you want. If there are any bugs, please let me know. Requirements: Python 3.5+ pip install -U discord.py pynacl youtube-dl You also need FFmpeg in your PATH environment variable or the FFmpeg.exe binary in your bot’s directory on Windows.
-
class
bot.cogs.music.
Music
(bot: discord.ext.commands.bot.Bot)¶ Bases:
discord.ext.commands.cog.Cog
-
async
cog_before_invoke
(ctx: discord.ext.commands.context.Context)¶ A special method that acts as a cog local pre-invoke hook.
This is similar to
Command.before_invoke()
.This must be a coroutine.
- Parameters
ctx (
Context
) – The invocation context.
-
cog_check
(ctx: discord.ext.commands.context.Context)¶ A special method that registers as a
commands.check()
for every command and subcommand in this cog.This function can be a coroutine and must take a sole parameter,
ctx
, to represent theContext
.
-
async
cog_command_error
(ctx: discord.ext.commands.context.Context, error: discord.ext.commands.errors.CommandError)¶ A special method that is called whenever an error is dispatched inside this cog.
This is similar to
on_command_error()
except only applying to the commands inside this cog.This function can be a coroutine.
- Parameters
ctx (
Context
) – The invocation context where the error happened.error (
CommandError
) – The error that happened.
-
cog_unload
()¶ A special method that is called when the cog gets removed.
This function cannot be a coroutine. It must be a regular function.
Subclasses must replace this if they want special unloading behaviour.
-
async
ensure_voice_state
(ctx: discord.ext.commands.context.Context)¶
-
get_voice_state
(ctx: discord.ext.commands.context.Context)¶
-
async
-
class
bot.cogs.music.
Song
(source: bot.cogs.music.YTDLSource)¶ Bases:
object
-
create_embed
()¶
-
requester
¶
-
source
¶
-
-
class
bot.cogs.music.
SongQueue
(maxsize=0, *, loop=None)¶ Bases:
asyncio.queues.Queue
-
clear
()¶
-
remove
(index: int)¶
-
shuffle
()¶
-
-
exception
bot.cogs.music.
VoiceError
¶ Bases:
Exception
-
class
bot.cogs.music.
VoiceState
(bot: discord.ext.commands.bot.Bot, ctx: discord.ext.commands.context.Context)¶ Bases:
object
-
async
audio_player_task
()¶
-
property
is_playing
¶
-
property
loop
¶
-
play_next_song
(error=None)¶
-
skip
()¶
-
async
stop
()¶
-
property
volume
¶
-
async
-
exception
bot.cogs.music.
YTDLError
¶ Bases:
Exception
-
class
bot.cogs.music.
YTDLSource
(ctx: discord.ext.commands.context.Context, source: discord.player.FFmpegPCMAudio, *, data: dict, volume: float = 0.5)¶ Bases:
discord.player.PCMVolumeTransformer
-
FFMPEG_OPTIONS
= {'before_options': '-reconnect 1 -reconnect_streamed 1 -reconnect_delay_max 5', 'options': '-vn'}¶
-
YTDL_OPTIONS
= {'audioformat': 'mp3', 'default_search': 'auto', 'extractaudio': True, 'format': 'bestaudio/best', 'ignoreerrors': False, 'logtostderr': False, 'no_warnings': True, 'nocheckcertificate': True, 'noplaylist': True, 'outtmpl': '%(extractor)s-%(id)s-%(title)s.%(ext)s', 'quiet': True, 'restrictfilenames': True, 'source_address': '0.0.0.0'}¶
-
async classmethod
create_source
(ctx: discord.ext.commands.context.Context, search: str, *, loop: asyncio.base_events.BaseEventLoop = None)¶
-
static
parse_duration
(duration: int)¶
-
ytdl
= <youtube_dl.YoutubeDL.YoutubeDL object>¶
-
-
bot.cogs.music.
setup
(bot)¶
bot.cogs.sitz module¶
-
class
bot.cogs.sitz.
Sitz
(bot)¶ Bases:
discord.ext.commands.cog.Cog
-
bot.cogs.sitz.
setup
(bot)¶
bot.cogs.svammel module¶
-
class
bot.cogs.svammel.
Svammel
(bot)¶ Bases:
discord.ext.commands.cog.Cog
-
bot.cogs.svammel.
setup
(bot)¶