| 1234567891011121314151617181920212223242526272829303132 |
- import discord
- from discord.ext import commands
- async def setup(bot: commands.Bot):
- await bot.add_cog(AngelEvents(bot))
- class AngelEvents(commands.Cog):
- """A couple Angel specific commands."""
- def __init__(self, bot: commands.Bot):
- self.bot = bot
- @commands.Cog.listener()
- async def on_message(self, message: discord.Message):
- feed_channels = [1184948763614253187]
- if message.channel.id in feed_channels:
- news_channel = self.bot.get_channel(971796738484625468)
- if message.type == discord.MessageType.channel_follow_add:
- source_channel = self.bot.get_channel(message.reference.channel_id)
- if source_channel:
- source_invite = await source_channel.create_invite(unique=False, reason="Linking back to discord of which news is being repeated.")
- await news_channel.send(message.author.mention + " [" + message.system_content.partition()[2] + "](" + source_invite + ")")
- else:
- await news_channel.send(message.author.mention + " " + message.system_content.partition(" ")[2])
- else:
- if message.author.bot:
- source_channel = self.bot.get_channel(message.reference.channel_id)
- if source_channel:
- source_invite = await source_channel.create_invite(unique=False, reason="Linking back to discord of which news is being repeated.")
- msg = await news_channel.send("**[" + message.author.name + "](<" + source_invite.url + ">)**:\n\n" + message.clean_content)
- else:
- await news_channel.send("**" + message.author.name + "**:\n\n" + message.clean_content)
|