Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 21 additions & 1 deletion cogs/fun.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
import random
import requests
from datetime import datetime
from gtts import gTTS
from discord import FFmpegPCMAudio


def get_zodiac(date, month):
Expand Down Expand Up @@ -181,6 +183,24 @@ async def richest(self, ctx):
embed.timestamp = datetime.now()

await ctx.send(embed=embed)



@commands.command(help='Get the bot to say Hello! when you are connected to a voice channel')
async def hello(self, ctx):
voice_state = ctx.author.voice
if voice_state == None:
await ctx.send("Join a voice channel to use this command!")
else:
channel = ctx.author.voice.channel
if ctx.guild.voice_client not in self.client.voice_clients:
voice = await channel.connect()

#Change Path of executable for ffmpeg
voice.play(FFmpegPCMAudio("hello.mp3", executable="C:\\ffmpeg\\bin\\ffmpeg"))

while voice.is_playing():
await asyncio.sleep(0)
await voice.disconnect()

async def setup(client):
await client.add_cog(Fun(client))
Binary file added hello.mp3
Binary file not shown.