eee
This commit is contained in:
parent
67494b82b8
commit
f3ccad70cf
@ -1,5 +1,6 @@
|
||||
#imports
|
||||
import version
|
||||
import main
|
||||
import sys
|
||||
import os
|
||||
import configparser
|
||||
@ -32,3 +33,7 @@ if config["config"]["autoupdate"] == "true":
|
||||
os.execl(sys.executable, sys.executable, *sys.argv)
|
||||
else:
|
||||
print("running latest version of turdbot",versionl)
|
||||
else:
|
||||
print("autoupdate disabled")
|
||||
|
||||
main.run()
|
||||
44
py/main.py
44
py/main.py
@ -9,39 +9,41 @@ import datetime
|
||||
import datetime
|
||||
import shelve
|
||||
import backports.zoneinfo as zoneinfo
|
||||
from py.storage import config
|
||||
from storage import config
|
||||
import version
|
||||
from discord import app_commands
|
||||
from discord.ext import tasks, commands
|
||||
|
||||
def run():
|
||||
|
||||
quotetime = datetime.time(hour=12, tzinfo=zoneinfo.ZoneInfo("MST"))
|
||||
avgtimelst = []
|
||||
quotetime = datetime.time(hour=12, tzinfo=zoneinfo.ZoneInfo("MST"))
|
||||
avgtimelst = []
|
||||
|
||||
token = open("py/TOKEN", "r").read()
|
||||
intents = discord.Intents.all()
|
||||
bot = commands.Bot(intents=intents, command_prefix=".")
|
||||
token = open("TOKEN", "r").read()
|
||||
intents = discord.Intents.all()
|
||||
bot = commands.Bot(intents=intents, command_prefix=".")
|
||||
|
||||
|
||||
# on ready
|
||||
@bot.event
|
||||
async def on_ready():
|
||||
print('We have logged in as {0.user}'.format(bot))
|
||||
# on ready
|
||||
@bot.event
|
||||
async def on_ready():
|
||||
print('logged in as {0.user}'.format(bot))
|
||||
print("discord.py version",discord.__version__)
|
||||
print("turdbot version",version.local())
|
||||
|
||||
if not dailyquote.is_running():
|
||||
dailyquote.start()
|
||||
print(bot.tree)
|
||||
print("discord.py version")
|
||||
print(discord.__version__)
|
||||
|
||||
|
||||
@bot.hybrid_command(name="eee", with_app_command=True)
|
||||
async def foo(ctx):
|
||||
@bot.hybrid_command(name="eee", with_app_command=True)
|
||||
async def foo(ctx):
|
||||
for guild in bot.guilds:
|
||||
await ctx.send(guild.id)
|
||||
|
||||
|
||||
# main event
|
||||
@bot.event
|
||||
async def on_message(message):
|
||||
# main event
|
||||
@bot.event
|
||||
async def on_message(message):
|
||||
# defining variables
|
||||
msg = str(message.content)
|
||||
channel = str(message.channel.id)
|
||||
@ -92,8 +94,8 @@ async def on_message(message):
|
||||
str(microseconds) + "\n average time: " + str(avgtime))
|
||||
|
||||
|
||||
@tasks.loop(time=quotetime, reconnect=True)
|
||||
async def dailyquote():
|
||||
@tasks.loop(time=quotetime, reconnect=True)
|
||||
async def dailyquote():
|
||||
if config("quotebotenabled") == "true":
|
||||
file = open("data/quotes.var", "r+")
|
||||
list = file.read().split(":")
|
||||
@ -105,4 +107,4 @@ async def dailyquote():
|
||||
file.close()
|
||||
|
||||
|
||||
bot.run(token)
|
||||
bot.run(token)
|
||||
|
||||
@ -15,7 +15,7 @@ def config(value,db="config",serverid=server,mode="r"):
|
||||
|
||||
|
||||
}
|
||||
data = shelve.open("bot.shlf",writeback=True)
|
||||
with shelve.open("bot.shlf",writeback=True) as data:
|
||||
if mode == "r":
|
||||
try:
|
||||
return data[db][serverid][value]
|
||||
@ -26,5 +26,3 @@ def config(value,db="config",serverid=server,mode="r"):
|
||||
return("success")
|
||||
else:
|
||||
print("error")
|
||||
data.close()
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user