Added WYA command to display where the bot is

This commit is contained in:
Logan Cusano
2022-03-17 23:10:13 -04:00
parent fdeb337ca5
commit 9456b91d09

38
bot.py
View File

@@ -69,6 +69,17 @@ class Bot(commands.Bot):
if ctx.author.id != self.user.id:
await ctx.send('pong')
# Command to display what channel the bot is in
@self.command(help="Use this command to display what channel the bot is in",
brief="Where ya at?")
async def wya(ctx, member: discord.Member = None):
member = member or ctx.author.display_name
if self.Bot_Connected:
await ctx.send(f"Hey {str(member).capitalize()}, I'm in {ctx.voice_client.channel}")
else:
await ctx.send(f"{str(member).capitalize()}, I am not in any channel.")
# Command to join the bot the voice channel the user who called the command 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")
@@ -146,16 +157,27 @@ class Bot(commands.Bot):
# Add commands for GQRX and OP25
if self.Handler in BotResources.PDB_ACCEPTABLE_HANDLERS.keys():
# Command to display the current config
@self.command(name='displayprofile',
@self.command(name='displaycurprofile',
help="Use this command to display the current configuration of the bot.\n"
"Example command:\n"
"\t@ displayprofile",
"\t@ displaycurprofile",
breif="Display current bot config")
async def _displayprofile(ctx, member: discord.Member = None):
async def _displaycurprofile(ctx, member: discord.Member = None):
member = member or ctx.author.display_name
message = self.display_current_radio_config()
await ctx.send(f"Ok {str(member).capitalize()},\n{message}")
# Command to display the current config
@self.command(name='displayprofiles',
help="Use this command to display the saved profiles.\n"
"Example command:\n"
"\t@ displayprofiles",
breif="Display current bot config")
async def _displayprofiles(ctx, member: discord.Member = None):
member = member or ctx.author.display_name
message = self.display_saved_radio_configs()
await ctx.send(f"Ok {str(member).capitalize()},\n{message}")
# Command to change the current frequency and mode
@self.command(name='chfreq', help="Use this command to change the frequency the bot is listening to.\n"
"Example GQRX command:\n"
@@ -476,3 +498,13 @@ class Bot(commands.Bot):
message_body += f"Squelch: {self.squelch}"
return message_body
def display_saved_radio_configs(self):
message_body = f"Saved configs"
config = configparser.ConfigParser()
if os.path.exists('./profiles.ini'):
config.read('./profiles.ini')
for section in config.sections():
message_body += f"{section}\n"
return message_body