spotty-amberS
Cyber Info3y ago
13 replies
spotty-amber

Need help enabling user bot commands

Hey everyone!,

I have created my first discord bot using python and the bot does show it connects in the code and on discord. However, I am lost to make the
!set_active_days
and
!set_extended_abscence
days command to work. I have included my code for its (seen below)

@bot.command(name='set_activity_days')
@commands.has_permissions(administrator=True)
async def set_activity_days(ctx, inactive_days_1: int, inactive_days_2: int):
  member = ctx.guild.get_member(ctx.guild.owner_id)
  member.activity_days_1 = inactive_days_1
  member.activity_days_2 = inactive_days_2
  await ctx.send(f"Activity days set successfully! Warning will be sent after {inactive_days_1} days of inactivity, and kick after {inactive_days_2} days of inactivity.")

@bot.command(name='set_extended_absence')
@commands.has_permissions(administrator=True)
async def set_extended_absence(ctx, member: discord.Member, extended_absence: bool):
  member.activity_extended_absence = extended_absence
  if extended_absence:
    await ctx.send(
      f"Extended absence status for {member.display_name} has been set to TRUE. The user will NOT receive kick warnings for inactivity."


according to this the command name is set_activity_days and set_extended_absence earlier in the code I set
"!"
as the prefix. However when I attempt to set the days to test the bot i get nothing:

Am I missing something I was told to get rid of
@commands.has_permissions(administrator=True)
and i tried that but still nothing
image.png
Was this page helpful?