- Added activity and status for bot user

This commit is contained in:
Logan Cusano
2021-12-22 02:28:41 -05:00
parent a60660eb03
commit 963e25eca9

13
bot.py
View File

@@ -9,7 +9,8 @@ class Bot(commands.Bot):
def __init__(self, **kwargs): # bot_token, device_id, device_name, command_prefix='>!'):
if 'command_prefix' not in kwargs.keys():
kwargs['command_prefix'] = '>!'
commands.Bot.__init__(self, command_prefix=commands.when_mentioned_or(kwargs['command_prefix']))
commands.Bot.__init__(self, command_prefix=commands.when_mentioned_or(kwargs['command_prefix']),
activity=discord.Game(name=f"@me"), status=discord.Status.idle)
self.DEVICE_ID = kwargs['Device_ID']
self.DEVICE_NAME = kwargs['Device_Name']
self.BOT_TOKEN = kwargs['Token']
@@ -29,7 +30,8 @@ class Bot(commands.Bot):
async def ping(ctx):
await ctx.send('pong')
@self.command(help="Use this command to join the bot to your channel", brief="Joins the voice channel that the caller is in")
@self.command(help="Use this command to join the bot to your channel",
brief="Joins the voice channel that the caller is in")
async def join(ctx, *, member: discord.Member = None):
member = member or ctx.author.display_name
await self.wait_until_ready()
@@ -45,12 +47,17 @@ class Bot(commands.Bot):
voice_connection = await channel.connect()
voice_connection.play(discord.PCMAudio(stream))
await self.change_presence(activity=discord.Activity(type=discord.ActivityType.listening,
name="the airwaves"),
status=discord.Status.online)
else:
await ctx.send("Opus won't load")
@self.command(help="Use this command to have the bot leave your channel", brief="Leaves the current voice channel")
@self.command(help="Use this command to have the bot leave your channel",
brief="Leaves the current voice channel")
async def leave(ctx):
await ctx.voice_client.disconnect()
await self.change_presence(activity=discord.Game(name=f"@me"), status=discord.Status.idle)
@self.command(name='reload', hidden=True)
async def _reload(ctx, module: str, member: discord.Member = None):