Dateien hochladen nach „“

This commit is contained in:
mloe 2022-10-19 23:57:15 +02:00
parent ff9e1a1f38
commit 04a0922c17

74
bot.py
View File

@ -1,36 +1,40 @@
from genericpath import exists from genericpath import exists
import subprocess import subprocess
import json import json
import discord import discord
from discord.ext import commands from discord.ext import commands
with open('config.json', 'r') as f: with open('config.json', 'r') as f:
data = json.load(f) data = json.load(f)
if exists('config.local.json'): if exists('config.local.json'):
with open('config.local.json') as f: with open('config.local.json') as f:
data = json.load(f) data = json.load(f)
intents = discord.Intents.default() intents = discord.Intents.default()
intents.message_content = True intents.message_content = True
description = '''Bot to end all bots''' description = '''Bot to end all bots'''
bot = commands.Bot(command_prefix='?', description=description, intents=intents) bot = commands.Bot(command_prefix='?', description=description, intents=intents)
@bot.event @bot.event
async def on_ready(): async def on_ready():
print(f'Logged in as {bot.user}') print(f'Logged in as {bot.user}')
print('------') print('------')
@bot.command() @bot.command()
async def add(ctx, left: int, right: int): async def add(ctx, left: int, right: int):
await ctx.send(left + right) await ctx.send(left + right)
@bot.command() @bot.command()
async def update(ctx): async def sub(ctx, left: int, right: int):
subprocess.Popen('./update.sh') await ctx.send(left - right)
print(f'Updating, see you on the other side')
@bot.command()
async def update(ctx):
subprocess.Popen('./update.sh')
print(f'Updating, see you on the other side')
bot.run(data['token']) bot.run(data['token'])