-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
40 lines (31 loc) · 866 Bytes
/
Copy pathmain.py
File metadata and controls
40 lines (31 loc) · 866 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
import discord
import os
from discord.ext import commands
from flask import Flask
intents = discord.Intents.default()
intents.members = True
bot = commands.Bot(command_prefix='!', intents=intents)
app = Flask(__name__)
@app.route('/')
def home():
return '<pre>' + bot_output + '</pre>'
@bot.event
async def on_ready():
global bot_output
bot_output = f'Logged in as {bot.user.name}'
print(bot_output)
@bot.event
async def on_message(message):
if message.channel.name == 'introduction':
if message.author.bot:
return
emoji = '<:ownboon:1112740466786566235>'
await message.add_reaction(emoji)
my_secret = os.environ['TOKEN']
bot_output = ''
import threading
def run_flask():
app.run(host='0.0.0.0', port=8080)
flask_thread = threading.Thread(target=run_flask)
flask_thread.start()
bot.run(my_secret)