Skip to content

Commit

Permalink
Update spamatron.py
Browse files Browse the repository at this point in the history
  • Loading branch information
BenCos17 committed Jun 23, 2024
1 parent 86383b0 commit 0d324be
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions spamatron/spamatron.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ async def spam(self, ctx, channel: discord.TextChannel, amount: int, *, message:
@commands.guild_only()
@commands.command()
@commands.has_permissions(administrator=True)
async def ghostping(self, ctx, member: discord.Member, amount: int = 1, interval: int = 1):
"""Ghostping a member."""
async def ghostping(self, ctx, member: discord.Member, channel: discord.TextChannel, amount: int = 1, interval: int = 1):
"""Ghostping a member in a specified channel."""
if amount <= 0:
return await ctx.send("Please provide a positive number for the amount.")
if interval <= 0:
Expand All @@ -48,15 +48,15 @@ async def ghostping(self, ctx, member: discord.Member, amount: int = 1, interval
if ctx.author.id in self.ghostping_tasks:
return await ctx.send("You already have a ghostping task running.")

async def ghostping_task(member, amount, interval):
async def ghostping_task(member, channel, amount, interval):
for _ in range(amount):
msg = await ctx.send(f"{member.mention} has been ghostpinged.")
msg = await channel.send(f"{member.mention} has been ghostpinged.")
await msg.delete()
await asyncio.sleep(interval)
self.ghostping_tasks.pop(ctx.author.id, None) # Remove the task from the dictionary after completion

self.ghostping_tasks[ctx.author.id] = self.bot.loop.create_task(ghostping_task(member, amount, interval))
await ctx.send(f"Ghostping task started for {member.mention} with {amount} pings at an interval of {interval} seconds.")
self.ghostping_tasks[ctx.author.id] = self.bot.loop.create_task(ghostping_task(member, channel, amount, interval))
await ctx.send(f"Ghostping task started for {member.mention} in {channel.mention} with {amount} pings at an interval of {interval} seconds.")

@commands.guild_only()
@commands.command()
Expand Down

0 comments on commit 0d324be

Please sign in to comment.