diff --git a/TOKEN b/TOKEN new file mode 100644 index 0000000..e69de29 diff --git a/bot.py b/bot.py index 9c5e6a8..e3495c8 100644 --- a/bot.py +++ b/bot.py @@ -1,16 +1,15 @@ +#imports import discord +import random +import configparser import backports.zoneinfo as zoneinfo import datetime -import time -import configparser -import random +from datetime import time from discord.ext import tasks, commands + + +#glob vars quotetime = datetime.time(hour=12,tzinfo=zoneinfo.ZoneInfo("MST")) -intents = discord.Intents.all() -client = discord.Client(intents=intents) -avgtimelst = [] -print("discord.py version") -print(discord.__version__) #loading config files @@ -23,15 +22,23 @@ quotebotconf.read("config/quotebot.conf") #bot info -@client.event +@bot.event async def on_ready(): - print('We have logged in as {0.user}'.format(client)) + print('We have logged in as {0.user}'.format(bot)) if not dailyquote.is_running(): dailyquote.start() +print("discord.py version") +print(discord.__version__) + + +@bot.command() +async def foo(ctx): + for guild in bot.guilds: + await ctx.send(guild.id) #main event -@client.event +@bot.event async def on_message(message): #defining variables msg = str(message.content) @@ -74,8 +81,13 @@ async def on_message(message): file.write(":") file.close() + #bot commands + await bot.process_commands(message) + #end function timer + global avgtimelst + avgtimelst = [] end = time.time() reventime = str(round((end - start),3)) avgtimelst.append(float(reventime)) @@ -90,10 +102,12 @@ async def dailyquote(): list = file.read().split(":") rand = random.randint(0, (len(list)-1)) print(rand) - channel = client.get_channel(int(quotebotconf["config"]["dailyquote"])) + channel = bot.get_channel(int(quotebotconf["config"]["dailyquote"])) await channel.send(list.pop(rand)) file.write(":".join(list)) file.close() -client.run(botconf["config"]["token"]) +intents = discord.Intents.all() +bot = commands.Bot(intents=intents,command_prefix=".") +bot.run(botconf["config"]["token"]) diff --git a/config/bot.conf b/config/bot.conf index b8af2e5..5b1dfa2 100644 --- a/config/bot.conf +++ b/config/bot.conf @@ -1,5 +1,5 @@ [config] -token = +token = OTg2NDA4MjM3Njg5NjMwNzYx.GfV6cT.3AywcQ7RIApTk4EAQP5nUayAoGPQxAEt79NKB8 replytobot = false [modules] diff --git a/data/quotes.var b/data/quotes.var index 98b359f..6915eb6 100644 --- a/data/quotes.var +++ b/data/quotes.var @@ -1 +1,9 @@ -joe mama -ian:joe mama -eric:avergae man -peter:hello:a:a:a:a:a:a:a:a:a:hello:hello:joe mama -ian:joe mama -eric:avergae man -peter:hello:a:a:a:a:a:a:a:a:hello:hello: \ No newline at end of file +joe mama -ian:joe mama -eric:avergae man -peter:hello:a:a:a:a:a:a:a:a:a:hello:hello:joe mama -ian:joe mama -eric:avergae man -peter:hello:a:a:a:a:a:a:a:a:hello:hello:we are declaring this house Vatican city and a portal to hell -trevor 2022 (edited):5 stars for the dinosaur portion. 3 stars for the porn exhibit (pretty sparse). -Museum of the Rockies Reviews 2021 +August 5, 2022:what is twitter? twitter is website where people go and talk shit about other people -radal 2022:McDonald's: exercise your pancreas -peter 2022 +August 9, 2022:christmas festive ass bowl w/ real wood knife -order invoice 2022 +August 10, 2022:bruh settings dosent have an option for nipple sensitivity -peter 2022 +August 24, 2022:A 1 billion port network switch would be longer than the continent of Africa - reddit 2022:if theres an option not to be talking to you id rather be playing tf2 -tf2 chat 2022 +August 31, 2022:asprin tree -person 2022:i just ran over all the rally car witnesses -peter 2022 +September 13, 2022:i know my fridge isnt racist because the mold includes every color -reddit 2022 +September 16, 2022:no shirt no shoes no service never said anything about pants -reddit 2022:free and open horse -trail sign 2022:give em a bludgeoning with the thinkpad -person 2022 +October 4, 2022:ich bin i just kicked your ass -tf2 solder 2007:create a problem and sell a solution -apple 2022:goddamnit we have the potato salad -ian 2022:i could pull it out to show you but then i wouldnt be having a fun time -ian 2022: \ No newline at end of file