This commit is contained in:
ionburger 2022-10-25 16:21:21 -06:00
parent f1ad230ada
commit 50ff47a034
13 changed files with 105 additions and 84 deletions

3
.gitignore vendored
View File

@ -1,4 +1,7 @@
*.conf
*.shlf
*test*
*TOKEN*
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]

1
TOKEN
View File

@ -1 +0,0 @@
OTg2NDA4MjM3Njg5NjMwNzYx.GfV6cT.3AywcQ7RIApTk4EAQP5nUayAoGPQxAEt79NKB8

BIN
bot.shlf

Binary file not shown.

View File

@ -1,7 +0,0 @@
[config]
token = OTg2NDA4MjM3Njg5NjMwNzYx.GfV6cT.3AywcQ7RIApTk4EAQP5nUayAoGPQxAEt79NKB8
replytobot = false
[modules]
triggerbot = "true"
quotebot = "true"

View File

@ -1,4 +0,0 @@
[config]
enabled = true
quotequeue = 1010042640508669982
dailyquote = 1004178748205187086

View File

@ -1,8 +0,0 @@
[config]
enabled = true
blacklist = 1234567890,0987654321 #blacklisted channels
triggers = hello,howdy
[replys]
hello = hello,hi
howdy = howdy

View File

@ -1,9 +0,0 @@
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:e:e:e:e:e:e:e:e:e:e:e:e:e:e:e:ee:e:e:e:e:e:e:e:e:e:e:e:e:e:e:ee:eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee:

35
html/about.html Normal file

File diff suppressed because one or more lines are too long

View File

@ -1,3 +1,9 @@
<!--
# Copyright (c) 2022, Ian Burgess
# All rights reserved.
#
# This source code is licensed under the GPLv3 license. A copy of this license can be found in the LICENSE file in the root directory of this source tree.
-->
<!DOCTYPE html>
<html lang="en">
<head>

BIN
images/a.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 43 KiB

BIN
images/coffee.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 404 KiB

View File

@ -1,47 +1,28 @@
#imports
# Copyright (c) 2022, Ian Burgess
# All rights reserved.
#
# This source code is licensed under the GPLv3 license. A copy of this license can be found in the LICENSE file in the root directory of this source tree.
import discord
import shelve
import random
import configparser
import backports.zoneinfo as zoneinfo
import datetime
import shelve
import datetime
import shelve
import backports.zoneinfo as zoneinfo
from py.storage import config
from discord.ext import tasks, commands
quotetime = datetime.time(hour=12,tzinfo=zoneinfo.ZoneInfo("MST"))
server = "global"
quotetime = datetime.time(hour=12, tzinfo=zoneinfo.ZoneInfo("MST"))
avgtimelst = []
token = open("TOKEN","r").read()
token = open("py/TOKEN", "r").read()
intents = discord.Intents.all()
bot = commands.Bot(intents=intents,command_prefix=".")
bot = commands.Bot(intents=intents, command_prefix=".")
#loading config files
def config(value,db="config",serverid=server,mode="r"):
global = {
"replytobot":"false",
"triggerbotenabled":"true",
"quotebotenabled":"true",
"triggerbottriggers":["hello","hi","howdy"],
"quotequeue":"1010042640508669982",
}
data = shelve.open("bot.shlf",writeback=True)
if mode == "r":
try:
return data[db][serverid][value]
except:
return global[value]
elif mode == "w":
data[db][serverid] = value
return("success")
else:
print("error")
data.close()
#bot info
# bot info
@bot.event
async def on_ready():
print('We have logged in as {0.user}'.format(bot))
@ -57,67 +38,63 @@ async def foo(ctx):
await ctx.send(guild.id)
#main event
# main event
@bot.event
async def on_message(message):
#defining variables
# defining variables
msg = str(message.content)
channel = str(message.channel.id)
server = message.guild.id
author = str(message.author)
#reply to bots
if message.author.bot and config("replytobot") == "false":
# reply to bots
if message.author.bot and config("replytobot") == "false":
return
#start event timer
# start event timer
print("\n start client.event")
start = datetime.datetime.now()
#triggerbot
# triggerbot
if config("triggerbotenabled") == "true":
x = 0
found = "false"
triggers = config("triggerbottriggers",db="data")
while x < len(triggers) and found == "false":
triggers = config("triggerbottriggers", db="data")
while x < len(triggers) and found == "false":
if triggers[x] not in msg:
x = x+1
elif triggers[x] in msg:
found = "true"
replys = config(triggerbotreplys,db=data)
rand = random.randint(0,len(replys))-1
replys = config(triggerbotreplys, db=data)
rand = random.randint(0, len(replys))-1
await message.channel.send(replys[rand])
else:
print("something happened")
#daily quote
# daily quote
if channel == config("quotequeue") and config("quotebotenabled") == "true":
file = open("data/quotes.var","a")
file = open("data/quotes.var", "a")
file.write(msg)
file.write(":")
file.close()
#bot commands
# bot commands
await bot.process_commands(message)
#end function timer
# end function timer
end = datetime.datetime.now()
eventime = (end - start)
microseconds = eventime.microseconds
avgtimelst.append(microseconds)
avgtime = sum(avgtimelst) / len(avgtimelst)
print("\n end client.event \n microseconds: " + str(microseconds) + "\n average time: " + str(avgtime))
print("\n end client.event \n microseconds: " +
str(microseconds) + "\n average time: " + str(avgtime))
@tasks.loop(time=quotetime,reconnect=True)
@tasks.loop(time=quotetime, reconnect=True)
async def dailyquote():
if config("quotebotenabled") == "true":
file = open("data/quotes.var","r+")
file = open("data/quotes.var", "r+")
list = file.read().split(":")
rand = random.randint(0, (len(list)-1))
print(rand)

29
py/storage.py Normal file
View File

@ -0,0 +1,29 @@
# Copyright (c) 2022, Ian Burgess
# All rights reserved.
#
# This source code is licensed under the GPLv3 license. A copy of this license can be found in the LICENSE file in the root directory of this source tree.
server = "default"
def config(value,db="config",serverid=server,mode="r"):
default = {
"replytobot":"false",
"triggerbotenabled":"true",
"quotebotenabled":"true",
"triggerbottriggers":["hello","hi","howdy"],
"quotequeue":"1010042640508669982",
}
data = shelve.open("bot.shlf",writeback=True)
if mode == "r":
try:
return data[db][serverid][value]
except:
return default[value]
elif mode == "w":
data[db][serverid] = value
return("success")
else:
print("error")
data.close()