Created
June 10, 2026 23:43
-
-
Save xacrimon/e980bd5b5cd6a5a881d7c76cebda107c to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import discord | |
| import selfcord | |
| import asyncio | |
| import logging | |
| from discord.ext import commands | |
| from dataclasses import dataclass | |
| discord.utils.setup_logging() | |
| BOT_TOKEN = "" | |
| USER_TOKEN = "" | |
| RELAY_TO_CHANNEL_ID = 1461458196257570837 | |
| RELAY_FROM_CHANNELS = [1440823746494726181, 1440824044424401006, 1195840346874187898, 1265754185471627305, 1133174355669553402, 1133173442355666964] | |
| intents = discord.Intents.default() | |
| intents.message_content = True | |
| bot = commands.Bot(command_prefix='$$', intents=intents) | |
| async def relay(embed: discord.Embed): | |
| channel = await bot.fetch_channel(RELAY_TO_CHANNEL_ID) | |
| if channel is None: | |
| print(f"Channel with ID {RELAY_TO_CHANNEL_ID} not found.") | |
| return | |
| await channel.send(content=None, embed=embed) | |
| @bot.command() | |
| async def ping(ctx): | |
| await ctx.send('pong') | |
| class UserClient(selfcord.Client): | |
| async def on_ready(self): | |
| print(f'User client logged in as {self.user}') | |
| async def on_message(self, message): | |
| if message.channel.id in RELAY_FROM_CHANNELS: | |
| channel = bot.get_channel(RELAY_TO_CHANNEL_ID) | |
| if channel is None: | |
| print(f"Channel with ID {RELAY_TO_CHANNEL_ID} not found.") | |
| return | |
| content = message.content | |
| if not content and len(message.embeds) > 0: | |
| content = f'{message.embeds[0].title}\n{message.embeds[0].description}' | |
| embed = discord.Embed(description=content, color=0x00ff00) | |
| name_text = f'{message.author.display_name} ({str(message.author)})' | |
| embed.set_author(name=name_text, icon_url=message.author.display_avatar.url) | |
| footer_text = f'#{message.channel.name} in {message.guild.name} - {message.created_at.strftime('%Y-%m-%d %H:%M:%S UTC')}' | |
| footer_icon_url = message.guild.icon.url if message.guild.icon else None | |
| embed.set_footer(text=footer_text, icon_url=footer_icon_url) | |
| asyncio.create_task(relay(embed)) | |
| async def main(): | |
| bot_task = asyncio.create_task(bot.start(BOT_TOKEN)) | |
| user_client = UserClient() | |
| user_task = asyncio.create_task(user_client.start(USER_TOKEN)) | |
| await bot_task | |
| await user_task | |
| asyncio.run(main()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment