-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdiscordside.py
More file actions
31 lines (26 loc) · 1.02 KB
/
Copy pathdiscordside.py
File metadata and controls
31 lines (26 loc) · 1.02 KB
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
import discord
from discord.ext import commands
from datetime import datetime
import logging
#handler = logging.FileHandler(filename='discord.log', encoding='utf-8', mode='w')
intents = discord.Intents.all()
bot = commands.Bot(command_prefix='!', intents=intents,)
global testingchannel; testingchannel=1338821320200425544
@bot.event
async def on_ready():
print(f'Logged in as {bot.user} (ID: {bot.user.id})')
print('------')
#im forced to do this cause "await can only be used in async functions"
global outputchannel; outputchannel=(bot.get_channel(1339062070804742198) or await bot.fetch_channel(1339062070804742198))
@bot.event
async def on_message(message):
if message.channel.id==testingchannel:
nickname=message.author.display_name
username=message.author.name
await outputchannel.send(f"`{nickname} ({username}):`\n {message.content}")
bot.run(
open("discordtoken.txt").read(),
reconnect=True,
#log_handler=handler,
#log_level=logging.DEBUG
)