Create songchanger
This commit is contained in:
parent
97dcd790f7
commit
4241171591
1 changed files with 19 additions and 0 deletions
19
customcommands/songchanger
Normal file
19
customcommands/songchanger
Normal file
|
@ -0,0 +1,19 @@
|
|||
import discord
|
||||
from discord.ext import commands
|
||||
from config import RED, GREEN, RESET
|
||||
class songchange(commands.Cog):
|
||||
def __init__(self, bot):
|
||||
self.bot = bot
|
||||
|
||||
@commands.command()
|
||||
async def changesong(self, ctx):
|
||||
await ctx.send("Check the terminal! (this does not persist across restarts)")
|
||||
song = input("\nEnter a song:\n")
|
||||
try:
|
||||
await self.bot.change_presence(activity=discord.Activity(type=discord.ActivityType.listening, name=f"{song}"))
|
||||
print(f"{GREEN}Changed song to {song}")
|
||||
except Exception as e:
|
||||
print(f"{RED}An error occurred while changing songs..: {str(e)}{RESET}")
|
||||
|
||||
async def setup(bot):
|
||||
await bot.add_cog(songchange(bot))
|
Loading…
Add table
Add a link
Reference in a new issue