abiddon
abiddon2y ago

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
!set_active_days
and
!set_extended_abscence
!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."
@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)
@commands.has_permissions(administrator=True)
and i tried that but still nothing
No description
10 Replies
Wagon
Wagon2y ago
Can you send the bot file, please make sure you do not have a bot token within this file or any other sensitive information.
abiddon
abiddonOP2y ago
Yeah I will do i send the bot file to you or put it in the discord
Wagon
Wagon2y ago
What intents do you have selected within the discord developer portal for your application
abiddon
abiddonOP2y ago
I selected all of them
abiddon
abiddonOP2y ago
No description
abiddon
abiddonOP2y ago
and the intent code is as follows:
intents = discord.Intents.default()
intents.members = True
bot = commands.Bot(command_prefix='!', intents=intents)
intents = discord.Intents.default()
intents.members = True
bot = commands.Bot(command_prefix='!', intents=intents)
Wagon
Wagon2y ago
I talked to some other guys, and I was unable to identify the issue. I would recommend checking out the official Discord.py server for more help; we primarily are focused on cybersecurity and cybersecurity education on this server. I am sorry I couldn't be more help. https://discord.gg/dpy
abiddon
abiddonOP2y ago
Okay seems that I have solved this issue Thank you @wagon_
Wagon
Wagon2y ago
No problem, sorry I couldn't do more. glad you got it figured out
abiddon
abiddonOP2y ago
yeah lol now im gonna have to figure out how to let the bot see past nicknames cause I noticed it will not use nicknames of members but its been an excellent learning expirience