Spaces:
Runtime error
Runtime error
Upload 3 files
Browse files- README.md +4 -4
- app.py +38 -0
- requirements.txt +4 -0
README.md
CHANGED
|
@@ -1,8 +1,8 @@
|
|
| 1 |
---
|
| 2 |
-
title:
|
| 3 |
-
emoji:
|
| 4 |
-
colorFrom:
|
| 5 |
-
colorTo:
|
| 6 |
sdk: gradio
|
| 7 |
sdk_version: 6.1.0
|
| 8 |
app_file: app.py
|
|
|
|
| 1 |
---
|
| 2 |
+
title: legends_proto
|
| 3 |
+
emoji: 🏆
|
| 4 |
+
colorFrom: gray
|
| 5 |
+
colorTo: purple
|
| 6 |
sdk: gradio
|
| 7 |
sdk_version: 6.1.0
|
| 8 |
app_file: app.py
|
app.py
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import asyncio
|
| 2 |
+
import os
|
| 3 |
+
import logging
|
| 4 |
+
|
| 5 |
+
import aiohttp
|
| 6 |
+
from aiohttp.resolver import AsyncResolver
|
| 7 |
+
import discord
|
| 8 |
+
from discord.ext import commands
|
| 9 |
+
import flask
|
| 10 |
+
import groq
|
| 11 |
+
|
| 12 |
+
logging.basicConfig(level=logging.INFO)
|
| 13 |
+
intents = discord.Intents.default()
|
| 14 |
+
intents.message_content = True
|
| 15 |
+
|
| 16 |
+
|
| 17 |
+
async def main():
|
| 18 |
+
resolver = AsyncResolver(nameservers=["1.1.1.1", "8.8.8.8"])
|
| 19 |
+
connector = aiohttp.TCPConnector(resolver=resolver)
|
| 20 |
+
bot = commands.Bot(intents=intents, connector=connector)
|
| 21 |
+
|
| 22 |
+
@bot.event
|
| 23 |
+
async def on_ready():
|
| 24 |
+
if os.environ.get('SET_USERNAME_FLAG'): # if flag exists, set username
|
| 25 |
+
await bot.user.edit(username="legends_proto")
|
| 26 |
+
print(f'We have logged in as {bot.user}')
|
| 27 |
+
|
| 28 |
+
@bot.event
|
| 29 |
+
async def on_message(message: discord.Message):
|
| 30 |
+
if not bot.user.mentioned_in(message) or message.author == bot.user:
|
| 31 |
+
return
|
| 32 |
+
print(f"DEBUG: Received message \"{message.content}\" from user \"{message.author}\"")
|
| 33 |
+
print("DEBUG: Sent message:", m := f"\"{message.content}\" yeah right lmfao 🥀🥀")
|
| 34 |
+
await message.channel.send(m)
|
| 35 |
+
|
| 36 |
+
await bot.start(os.getenv('DISCORD_TOKEN'))
|
| 37 |
+
|
| 38 |
+
asyncio.run(main())
|
requirements.txt
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
aiodns
|
| 2 |
+
discord.py
|
| 3 |
+
flask
|
| 4 |
+
groq
|