Files
bot-discord/main.py
2022-04-26 20:15:38 +02:00

46 lines
1.1 KiB
Python

"""
version 2.0.0
author 4nima, oce
description template for discord bot
requirements
- discord
- flask (for keep_alive)
"""
## Imports
import json
import logging as log
import discord
from discord import app_commands
#from lib.keep_alive import keep_alive
from bot import client
intents = discord.Intents.default()
intents.message_content = True
guild_id = '283156308465811456'
bot = client(intents)
## Vars
### Load and set Bot Config
with open("bot.conf", 'r') as f:
BOTDATA = json.load(f)
### Set logging options
log.basicConfig(
filename="bot.log",
level=log.DEBUG,
format='%(asctime)s - %(process)d-%(levelname)s: %(message)s',
datefmt='%Y-%m-%d %H:%M:%S'
)
# run
# bot defination
@bot.tree.command(guild = discord.Object(id=guild_id), name = 'tester', description='testing') #guild specific slash command
async def slash2(interaction: discord.Interaction):
await interaction.response.send_message(f"I am working! I was made with Discord.py!", ephemeral = True)
bot.run(BOTDATA['token'])