Rifat Azad commited on
Commit
c7c1182
·
1 Parent(s): f2a123b
Files changed (1) hide show
  1. pydvpl_bot.py +19 -29
pydvpl_bot.py CHANGED
@@ -630,35 +630,25 @@ async def announce(ctx, *, message):
630
  if announcement_channel:
631
  await announcement_channel.send(message)
632
  await ctx.send(f"Message `{message}` sent to server `{server.name}` in `important-announcements` channel.")
633
- await ctx.message.delete()
634
- continue # Move to the next server
635
-
636
- # If no "important-announcements" channel, check for "announcements" channel
637
- announcements_channel = discord.utils.get(server.channels, name="announcements")
638
- if announcements_channel:
639
- await announcements_channel.send(message)
640
- await ctx.send(f"Message `{message}` sent to server `{server.name}` in `announcements` channel.")
641
- await ctx.message.delete()
642
- continue # Move to the next server
643
-
644
- # If neither, check for "public updates" channel
645
- public_updates_channel = server.public_updates_channel
646
- if public_updates_channel:
647
- await public_updates_channel.send(message)
648
- await ctx.send(f"Message `{message}` sent to server `{server.name}` in `public updates` channel.")
649
- await ctx.message.delete()
650
- continue # Move to the next server
651
-
652
- # If no specific channel found, send to the default channel (first text channel)
653
- default_channel = server.system_channel or server.text_channels[0]
654
- if default_channel:
655
- await default_channel.send(message)
656
- await ctx.send(f"Message `{message}` sent to server `{server.name}` in the default channel.")
657
- await ctx.message.delete()
658
- continue # Move to the next server
659
-
660
- # If no appropriate channel found, notify that no suitable channel was found
661
- await ctx.send(f"No suitable announcement channel found in server `{server.name}`.")
662
 
663
  # Delete the original command message
664
  await ctx.message.delete()
 
630
  if announcement_channel:
631
  await announcement_channel.send(message)
632
  await ctx.send(f"Message `{message}` sent to server `{server.name}` in `important-announcements` channel.")
633
+ else:
634
+ # If no "important-announcements" channel, check for "announcements" channel
635
+ announcements_channel = discord.utils.get(server.channels, name="announcements")
636
+ if announcements_channel:
637
+ await announcements_channel.send(message)
638
+ await ctx.send(f"Message `{message}` sent to server `{server.name}` in `announcements` channel.")
639
+ else:
640
+ # If neither channel exists, send to the default channel or public updates channel
641
+ public_updates_channel = server.public_updates_channel
642
+ if public_updates_channel:
643
+ await public_updates_channel.send(message)
644
+ await ctx.send(f"Message `{message}` sent to server `{server.name}` in `public updates` channel.")
645
+ else:
646
+ default_channel = server.system_channel or server.text_channels[0]
647
+ if default_channel:
648
+ await default_channel.send(message)
649
+ await ctx.send(f"Message `{message}` sent to server `{server.name}` in the default channel.")
650
+ else:
651
+ await ctx.send(f"No suitable announcement channel found in server `{server.name}`.")
 
 
 
 
 
 
 
 
 
 
652
 
653
  # Delete the original command message
654
  await ctx.message.delete()