48 lines
948 B
Python
48 lines
948 B
Python
####################
|
|
# == Main Info ==
|
|
# main.py
|
|
# by 4nima
|
|
# v.0.0.0
|
|
#
|
|
####################
|
|
# == Descrtiption ==
|
|
# template for discord bot
|
|
#
|
|
####################
|
|
# == Dependencies ==
|
|
# pip3 install discord
|
|
# pip3 install flask (for keep_alive)
|
|
####################
|
|
|
|
## Imports
|
|
import json
|
|
|
|
from discord.ext import commands
|
|
from lib.keep_alive import keep_alive
|
|
|
|
## Vars
|
|
with open("bot.conf", 'r') as f:
|
|
BOTDATA = json.load(f)
|
|
bot = commands.Bot(command_prefix=BOTDATA['prefix'])
|
|
|
|
## Run
|
|
### Events
|
|
@bot.event
|
|
async def on_ready():
|
|
print(f'Logged in as {bot.user}')
|
|
|
|
for guild in bot.guilds:
|
|
print(f'Connect to Server {guild.name} (id: {guild.id})')
|
|
|
|
### Commands
|
|
@bot.command(name='hello', help='Say hello!')
|
|
async def say_hello(ctx):
|
|
await ctx.send(f'Hello, <@{ctx.author.id}>!')
|
|
print(ctx.guild)
|
|
print(ctx.message.content)
|
|
print(ctx.message)
|
|
print(ctx.author)
|
|
|
|
#keep_alive()
|
|
bot.run(BOTDATA['token'])
|