Resolve merge conflict and add telegram forwarder

This commit is contained in:
esef committed 2026-06-22 22:17:20 +03:00
commit 1ce7ea15d9
23 files changed
+586 -202

No files matched your search

+43 -43
View File
@@ -1,43 +1,43 @@
import discord
from discord.ext import commands
from dotenv import load_dotenv
import os
import logging
import asyncio
from tgbridge.forwarder import TelegramForwarder
load_dotenv('credentials.env')
intents = discord.Intents.default()
intents.message_content = True
bot = commands.Bot(command_prefix='!', intents=intents)
forwarder = TelegramForwarder(
token=os.getenv('TELEGRAM_BOT_TOKEN'),
group_id=int(os.getenv('TELEGRAM_GROUP_ID')),
webhook_url=os.getenv('DISCORD_WEBHOOK_URL'),
)
@bot.event
async def on_ready():
print(f'✅ {bot.user} is online!')
asyncio.create_task(forwarder.start())
async def main():
async with bot:
await bot.load_extension('cogs.general')
await bot.load_extension('cogs.chance')
await bot.load_extension('cogs.gifs')
await bot.load_extension('cogs.copypasta')
await bot.load_extension('cogs.sysinfo')
await bot.load_extension('music.music')
try:
await bot.start(os.getenv('DISCORD_TOKEN'))
finally:
await forwarder.stop()
logging.basicConfig(level=logging.INFO)
asyncio.run(main())␍
import discord
from discord.ext import commands
from dotenv import load_dotenv
import os
import logging
import asyncio
from tgbridge.forwarder import TelegramForwarder
load_dotenv('credentials.env')
intents = discord.Intents.default()
intents.message_content = True
bot = commands.Bot(command_prefix='!', intents=intents)
forwarder = TelegramForwarder(
token=os.getenv('TELEGRAM_BOT_TOKEN'),
group_id=int(os.getenv('TELEGRAM_GROUP_ID')),
webhook_url=os.getenv('DISCORD_WEBHOOK_URL'),
)
@bot.event
async def on_ready():
print(f'✅ {bot.user} is online!')
asyncio.create_task(forwarder.start())
async def main():
async with bot:
await bot.load_extension('cogs.general')
await bot.load_extension('cogs.chance')
await bot.load_extension('cogs.gifs')
await bot.load_extension('cogs.copypasta')
await bot.load_extension('cogs.sysinfo')
await bot.load_extension('music.music')
try:
await bot.start(os.getenv('DISCORD_TOKEN'))
finally:
await forwarder.stop()
logging.basicConfig(level=logging.INFO)
asyncio.run(main())