WelcomeBot / app.py
lunarflu's picture
lunarflu HF Staff
Update app.py
3b72ee5
raw
history blame
762 Bytes
import discord
import os
import threading
from discord.ext import commands
import gradio_client
import gradio as gr
from gradio_client import Client
DISCORD_TOKEN = os.environ.get("DISCORD_TOKEN", None)
intents = discord.Intents.all()
bot = commands.Bot(command_prefix='!', intents=intents)
@bot.event
async def on_member_join(member):
channel = bot.get_channel(932563860597121054)
message = f'Welcome to the server, {member.mention}! :hugging_face:'
await channel.send(message)
DISCORD_TOKEN = os.environ.get("DISCORD_TOKEN", None)
def run_bot():
bot.run(DISCORD_TOKEN)
threading.Thread(target=run_bot).start()
def greet(name):
return "Hello " + name + "!"
demo = gr.Interface(fn=greet, inputs="text", outputs="text")
demo.launch()