cunny
This commit is contained in:
parent
7b2e1957e3
commit
cb30788154
BIN
chatbot.db
BIN
chatbot.db
Binary file not shown.
546
dialoggptBot.py
546
dialoggptBot.py
@ -9,6 +9,233 @@ import re
|
|||||||
from unidecode import unidecode
|
from unidecode import unidecode
|
||||||
import sqlite3
|
import sqlite3
|
||||||
import random
|
import random
|
||||||
|
|
||||||
|
import requests
|
||||||
|
import sseclient
|
||||||
|
import json
|
||||||
|
|
||||||
|
url = "http://127.0.0.1:5000/v1/chat/completions"
|
||||||
|
|
||||||
|
headers = {
|
||||||
|
"Content-Type": "application/json"
|
||||||
|
}
|
||||||
|
|
||||||
|
queue = []
|
||||||
|
|
||||||
|
isGenerating = False
|
||||||
|
|
||||||
|
async def parser(content, usrmsg):
|
||||||
|
#print("Parsing: " + content)
|
||||||
|
prompt = ""
|
||||||
|
tokens = 1500
|
||||||
|
temperature = 0.7
|
||||||
|
top_p = 1
|
||||||
|
top_k = 0
|
||||||
|
typical_p = 1
|
||||||
|
min_p = 0.05
|
||||||
|
repetition_penalty = 1
|
||||||
|
frequency_penalty = 0
|
||||||
|
presence_penalty = 0
|
||||||
|
|
||||||
|
c = content.split("--")
|
||||||
|
prompt = c[0]
|
||||||
|
c.pop(0)
|
||||||
|
for i in c:
|
||||||
|
cs = i.split()
|
||||||
|
if (cs[0] == "tokens"):
|
||||||
|
try:
|
||||||
|
tokens = int(cs[1])
|
||||||
|
if (tokens <= 9 or tokens > 4096):
|
||||||
|
await usrmsg.reply("Invalid token count")
|
||||||
|
return
|
||||||
|
except:
|
||||||
|
await usrmsg.reply("Error: --tokens")
|
||||||
|
return
|
||||||
|
elif (cs[0] == "temp"):
|
||||||
|
try:
|
||||||
|
temperature = float(cs[1])
|
||||||
|
if (temperature > 5 or temperature < 0):
|
||||||
|
await usrmsg.reply("Invalid temperature")
|
||||||
|
return
|
||||||
|
except:
|
||||||
|
await usrmsg.reply("Error: --temp")
|
||||||
|
return
|
||||||
|
elif (cs[0] == "top_p"):
|
||||||
|
try:
|
||||||
|
top_p = float(cs[1])
|
||||||
|
if (top_p > 1 or top_p < 0):
|
||||||
|
await usrmsg.reply("Invalid top_p")
|
||||||
|
return
|
||||||
|
except:
|
||||||
|
await usrmsg.reply("Error: --top_p")
|
||||||
|
return
|
||||||
|
|
||||||
|
elif (cs[0] == "top_k"):
|
||||||
|
try:
|
||||||
|
top_k = int(cs[1])
|
||||||
|
if (top_p > 200 or top_p < 0):
|
||||||
|
await usrmsg.reply("Invalid top_k")
|
||||||
|
return
|
||||||
|
except:
|
||||||
|
await usrmsg.reply("Error: --top_k")
|
||||||
|
return
|
||||||
|
elif (cs[0] == "typical_p"):
|
||||||
|
try:
|
||||||
|
typical_p = float(cs[1])
|
||||||
|
if (typical_p > 1 or typical_p < 0):
|
||||||
|
await usrmsg.reply("Invalid typical_p")
|
||||||
|
return
|
||||||
|
except:
|
||||||
|
await usrmsg.reply("Error: --typical_p")
|
||||||
|
return
|
||||||
|
|
||||||
|
elif (cs[0] == "min_p"):
|
||||||
|
try:
|
||||||
|
min_p = float(cs[1])
|
||||||
|
if (min_p > 1 or min_p < 0):
|
||||||
|
await usrmsg.reply("Invalid min_p")
|
||||||
|
return
|
||||||
|
except:
|
||||||
|
await usrmsg.reply("Error: --min_p")
|
||||||
|
return
|
||||||
|
|
||||||
|
elif (cs[0] == "rep_p"):
|
||||||
|
try:
|
||||||
|
repetition_penalty = float(cs[1])
|
||||||
|
if (repetition_penalty > 1.5 or repetition_penalty < 1):
|
||||||
|
await usrmsg.reply("Invalid rep_p")
|
||||||
|
return
|
||||||
|
except:
|
||||||
|
await usrmsg.reply("Error: --rep_p")
|
||||||
|
return
|
||||||
|
|
||||||
|
elif (cs[0] == "freq_p"):
|
||||||
|
try:
|
||||||
|
frequency_penalty = float(cs[1])
|
||||||
|
if (frequency_penalty > 2 or frequency_penalty < 0):
|
||||||
|
await usrmsg.reply("Invalid freq_p")
|
||||||
|
return
|
||||||
|
except:
|
||||||
|
await usrmsg.reply("Error: --freq_p")
|
||||||
|
return
|
||||||
|
|
||||||
|
elif (cs[0] == "pres_p"):
|
||||||
|
try:
|
||||||
|
presence_penalty = float(cs[1])
|
||||||
|
if (presence_penalty > 2 or presence_penalty < 0):
|
||||||
|
await usrmsg.reply("Invalid pres_p")
|
||||||
|
return
|
||||||
|
except:
|
||||||
|
await usrmsg.reply("Error: --pres_p")
|
||||||
|
return
|
||||||
|
else:
|
||||||
|
await usrmsg.reply("Invalid switch. Please use the following switches instead: --tokens, --temp, --top_p, --top_k, --typical_p, --min_p, --rep_p, --freq_p, --pres_p")
|
||||||
|
return
|
||||||
|
return prompt, tokens, temperature, top_p, top_k, typical_p, min_p, repetition_penalty, frequency_penalty, presence_penalty
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
async def aiGen(usrmsg):
|
||||||
|
global isGenerating
|
||||||
|
if (not usrmsg is None):
|
||||||
|
content = usrmsg.content[5:]
|
||||||
|
if(isGenerating):
|
||||||
|
try:
|
||||||
|
p = await parser(content, usrmsg)
|
||||||
|
if (len(p) == 0):
|
||||||
|
return
|
||||||
|
except:
|
||||||
|
return
|
||||||
|
try:
|
||||||
|
botmsg = await usrmsg.reply(f"Queued... Position: {len(queue)+1}")
|
||||||
|
except:
|
||||||
|
return
|
||||||
|
queue.append([usrmsg, botmsg, content])
|
||||||
|
return
|
||||||
|
else:
|
||||||
|
isGenerating = True
|
||||||
|
history = []
|
||||||
|
botmsg = 0
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
if (usrmsg is None and len(queue) > 0):
|
||||||
|
k = queue.pop(0)
|
||||||
|
usrmsg = k[0]
|
||||||
|
botmsg = k[1]
|
||||||
|
content = k[2]
|
||||||
|
if(len(queue) > 0):
|
||||||
|
for d in range(len(queue)):
|
||||||
|
await queue[d][1].edit(content=f"Queued... Position: {d+1}")
|
||||||
|
data = {}
|
||||||
|
try:
|
||||||
|
(prompt, tokens, temp, top_p, top_k, typ_p, min_p, rep_p, freq_p, pres_p) = await parser(content, usrmsg)
|
||||||
|
history.append({"role": "user", "content": prompt})
|
||||||
|
#print("Prompt: "+ prompt)
|
||||||
|
data = {
|
||||||
|
"mode": "instruct",
|
||||||
|
"stream": True,
|
||||||
|
"max_tokens": tokens,
|
||||||
|
"temperature": temp,
|
||||||
|
"top_p": top_p,
|
||||||
|
"top_k": top_k,
|
||||||
|
"typical_p": typ_p,
|
||||||
|
"min_p": min_p,
|
||||||
|
"repetition_penalty": rep_p,
|
||||||
|
"frequency_penalty": freq_p,
|
||||||
|
"presence_penalty": pres_p,
|
||||||
|
"messages": history
|
||||||
|
}
|
||||||
|
except Exception as e:
|
||||||
|
print(e)
|
||||||
|
isGenerating = False
|
||||||
|
return
|
||||||
|
|
||||||
|
stream_response = requests.post(url, headers=headers, json=data, verify=False, stream=True)
|
||||||
|
client = sseclient.SSEClient(stream_response)
|
||||||
|
assistant_message = ''
|
||||||
|
charcount = 0
|
||||||
|
if (botmsg != 0):
|
||||||
|
await botmsg.delete()
|
||||||
|
botmsg = 0
|
||||||
|
try:
|
||||||
|
botmsg = await usrmsg.reply("Generating")
|
||||||
|
except:
|
||||||
|
botmsg = 0
|
||||||
|
if (botmsg != 0):
|
||||||
|
for event in client.events():
|
||||||
|
payload = json.loads(event.data)
|
||||||
|
#print(payload)
|
||||||
|
chunk = payload['choices'][0]['delta']['content']
|
||||||
|
assistant_message += chunk
|
||||||
|
charcount += len(chunk)
|
||||||
|
if (chunk == ''):
|
||||||
|
if(assistant_message == ''):
|
||||||
|
continue
|
||||||
|
else:
|
||||||
|
charcount = 100
|
||||||
|
if (len(assistant_message) < 2000 and charcount > 50):
|
||||||
|
if (len(assistant_message.strip()) > 0):
|
||||||
|
await botmsg.edit(content=assistant_message)
|
||||||
|
else:
|
||||||
|
await botmsg.edit(content="<spaces>...")
|
||||||
|
charcount = 0
|
||||||
|
elif(len(assistant_message) >= 2000):
|
||||||
|
await botmsg.edit(content=assistant_message[:-len(chunk)])
|
||||||
|
botmsg = await botmsg.channel.send(chunk + "...")
|
||||||
|
assistant_message = chunk
|
||||||
|
charcount = 0
|
||||||
|
isGenerating = False
|
||||||
|
await asyncio.sleep(1)
|
||||||
|
if(len(queue) > 0):
|
||||||
|
await aiGen(None)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def cleanString(mystr):
|
def cleanString(mystr):
|
||||||
mystr3 = unidecode(mystr)
|
mystr3 = unidecode(mystr)
|
||||||
mystr2 = ''.join(letter for letter in mystr3 if (letter.isalnum() or letter==' '))
|
mystr2 = ''.join(letter for letter in mystr3 if (letter.isalnum() or letter==' '))
|
||||||
@ -22,7 +249,10 @@ async def delMsg(msg):
|
|||||||
load_dotenv()
|
load_dotenv()
|
||||||
debug=False
|
debug=False
|
||||||
|
|
||||||
client = discord.Client()
|
intents = discord.Intents.default()
|
||||||
|
intents.message_content = True
|
||||||
|
#intents.members = True
|
||||||
|
client = discord.Client(intents = intents)
|
||||||
"""
|
"""
|
||||||
##init model
|
##init model
|
||||||
tokenizer, model = load_tokenizer_and_model()
|
tokenizer, model = load_tokenizer_and_model()
|
||||||
@ -31,8 +261,10 @@ print("Model Loaded")
|
|||||||
#lazy way rn, may change latter to record and load back
|
#lazy way rn, may change latter to record and load back
|
||||||
chat_histories={}
|
chat_histories={}
|
||||||
"""
|
"""
|
||||||
serious_channels = [974553346591576105,927849858025529474, 972963507916128297]
|
serious_channels = [974553346591576105,927849858025529474, 972963507916128297, 912240638664257553]
|
||||||
con = sqlite3.connect("chatbot.db")
|
allowed_channels = [960797708522758184,912240638664257555,1061819577744502794,1062285903634120755, 1062057141223034971, 1062619209047232512, 1061901489402019860]
|
||||||
|
path = "/home/lawrence/chatbot/"
|
||||||
|
con = sqlite3.connect(path + "chatbot.db")
|
||||||
cur = con.cursor()
|
cur = con.cursor()
|
||||||
haram_users = []
|
haram_users = []
|
||||||
|
|
||||||
@ -44,37 +276,36 @@ haramUser = []
|
|||||||
haramTwo = []
|
haramTwo = []
|
||||||
|
|
||||||
lastHaram = 0
|
lastHaram = 0
|
||||||
|
f = open(path + "haramwords.txt", "r")
|
||||||
f = open("haramwords.txt", "r")
|
|
||||||
for x in f:
|
for x in f:
|
||||||
sexWords.append(x.replace("\n", ""))
|
sexWords.append(x.replace("\n", ""))
|
||||||
f.close()
|
f.close()
|
||||||
|
|
||||||
f = open("haramuser.txt", "r")
|
f = open(path + "haramuser.txt", "r")
|
||||||
for x in f:
|
for x in f:
|
||||||
haramUser.append(x.replace("\n", ""))
|
haramUser.append(x.replace("\n", ""))
|
||||||
f.close()
|
f.close()
|
||||||
|
|
||||||
f = open("haramtwo.txt", "r")
|
f = open( path + "haramtwo.txt", "r")
|
||||||
for x in f:
|
for x in f:
|
||||||
haramTwo.append(x.replace("\n", ""))
|
haramTwo.append(x.replace("\n", ""))
|
||||||
f.close()
|
f.close()
|
||||||
sexRegex = []
|
sexRegex = []
|
||||||
|
|
||||||
f = open("haramregex.txt", "r")
|
f = open(path + "haramregex.txt", "r")
|
||||||
for x in f:
|
for x in f:
|
||||||
sexRegex.append(x.replace("\n", ""))
|
sexRegex.append(x.replace("\n", ""))
|
||||||
f.close()
|
f.close()
|
||||||
|
|
||||||
sisRegex = []
|
sisRegex = []
|
||||||
|
|
||||||
f = open("haramsis.txt", "r")
|
f = open(path + "haramsis.txt", "r")
|
||||||
for x in f:
|
for x in f:
|
||||||
sisRegex.append(x.replace("\n", ""))
|
sisRegex.append(x.replace("\n", ""))
|
||||||
f.close()
|
f.close()
|
||||||
|
|
||||||
|
|
||||||
f = open("catlist.txt", "r")
|
f = open(path + "catlist.txt", "r")
|
||||||
lines = f.readlines()
|
lines = f.readlines()
|
||||||
|
|
||||||
def dellast(filename):
|
def dellast(filename):
|
||||||
@ -91,13 +322,15 @@ async def getUsername(userid):
|
|||||||
res = cur.execute(f"SELECT username FROM totals WHERE id={userid}").fetchone()
|
res = cur.execute(f"SELECT username FROM totals WHERE id={userid}").fetchone()
|
||||||
if (res is None or res[0] is None or res[0]==""):
|
if (res is None or res[0] is None or res[0]==""):
|
||||||
try:
|
try:
|
||||||
user = await client.fetch_user(userid)
|
guild = await client.fetch_guild(912240638664257546)
|
||||||
except:
|
user = await guild.fetch_member(userid)
|
||||||
|
except Exception as error:
|
||||||
|
#print("Error: "+error)
|
||||||
#user doesn't exist
|
#user doesn't exist
|
||||||
return None
|
return None
|
||||||
|
|
||||||
if (res is None):
|
if (res is None):
|
||||||
cur.execute(f"INSERT INTO totals VALUES({userid}, 0,\"{user.name}\")")
|
cur.execute(f"INSERT INTO totals VALUES({userid}, 0,\"{user.name}\", \"\")")
|
||||||
else:
|
else:
|
||||||
cur.execute(f"UPDATE totals SET username=\"{user.name}\" WHERE id={userid}")
|
cur.execute(f"UPDATE totals SET username=\"{user.name}\" WHERE id={userid}")
|
||||||
con.commit()
|
con.commit()
|
||||||
@ -123,11 +356,17 @@ async def on_ready():
|
|||||||
async def addItem(message, wordlist, wordfile,lastid):
|
async def addItem(message, wordlist, wordfile,lastid):
|
||||||
global lastHaram
|
global lastHaram
|
||||||
if (not "\"" in message.content.lower()):
|
if (not "\"" in message.content.lower()):
|
||||||
await message.reply("Wrong syntax - word must be in quotes")
|
try:
|
||||||
|
await message.reply("Wrong syntax - word must be in quotes")
|
||||||
|
except:
|
||||||
|
return
|
||||||
return
|
return
|
||||||
word = message.content.lower().split("\"")[1]
|
word = message.content.lower().split("\"")[1]
|
||||||
if (word in wordlist or (word+" ") in wordlist or (" "+word) in wordlist or (" "+word+" ") in wordlist):
|
if (word in wordlist or (word+" ") in wordlist or (" "+word) in wordlist or (" "+word+" ") in wordlist):
|
||||||
await message.reply("Already in DB")
|
try:
|
||||||
|
await message.reply("Already in DB")
|
||||||
|
except:
|
||||||
|
return
|
||||||
return
|
return
|
||||||
else:
|
else:
|
||||||
wordlist.append(word)
|
wordlist.append(word)
|
||||||
@ -135,12 +374,36 @@ async def addItem(message, wordlist, wordfile,lastid):
|
|||||||
f.write(word+"\n")
|
f.write(word+"\n")
|
||||||
f.close()
|
f.close()
|
||||||
lastHaram = lastid
|
lastHaram = lastid
|
||||||
await message.reply("Added: \""+word+"\"")
|
try:
|
||||||
|
await message.reply("Added: \""+word+"\"")
|
||||||
|
except:
|
||||||
|
return
|
||||||
|
|
||||||
@client.event
|
@client.event
|
||||||
async def on_message(message):
|
async def on_message(message):
|
||||||
global lastHaram
|
global lastHaram
|
||||||
#print(chat_histories)
|
#print(message.content)
|
||||||
|
if (message.content[:5] == "!gen "):
|
||||||
|
if(message.channel.id in allowed_channels):
|
||||||
|
await aiGen(message)
|
||||||
|
else:
|
||||||
|
try:
|
||||||
|
await message.reply("Chatbot disabled in this channel")
|
||||||
|
except:
|
||||||
|
return
|
||||||
|
if (message.content == "!queue"):
|
||||||
|
r = f"Queue Length: {len(queue)}\n"
|
||||||
|
for d in range(min(len(queue), 10)):
|
||||||
|
pr = queue[d][2]
|
||||||
|
if (len(pr) > 150):
|
||||||
|
pr = pr[:150] + "..."
|
||||||
|
r += f"{d+1}: {pr} \n"
|
||||||
|
try:
|
||||||
|
await message.reply(r)
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
return
|
||||||
|
|
||||||
if (message.author.id in admin and message.content.lower()[:9] == "!haramadd"):
|
if (message.author.id in admin and message.content.lower()[:9] == "!haramadd"):
|
||||||
await addItem(message, sexWords, "haramwords.txt", 0)
|
await addItem(message, sexWords, "haramwords.txt", 0)
|
||||||
return
|
return
|
||||||
@ -148,7 +411,10 @@ async def on_message(message):
|
|||||||
await addItem(message, sexRegex, "haramregex.txt", 1)
|
await addItem(message, sexRegex, "haramregex.txt", 1)
|
||||||
return
|
return
|
||||||
if (message.content == "!haramnum"):
|
if (message.content == "!haramnum"):
|
||||||
await message.reply("Haram list: "+str(len(sexWords))+", Haram regex: "+str(len(sexRegex))+ ", Haram sis: "+str(len(sisRegex)))
|
try:
|
||||||
|
await message.reply("Haram list: "+str(len(sexWords))+", Haram regex: "+str(len(sexRegex))+ ", Haram sis: "+str(len(sisRegex)))
|
||||||
|
except:
|
||||||
|
pass
|
||||||
return
|
return
|
||||||
if (message.author.id in admin and message.content.lower()[:9] == "!haramsis"):
|
if (message.author.id in admin and message.content.lower()[:9] == "!haramsis"):
|
||||||
await addItem(message, sisRegex, "haramsis.txt", 2)
|
await addItem(message, sisRegex, "haramsis.txt", 2)
|
||||||
@ -160,111 +426,126 @@ async def on_message(message):
|
|||||||
await addItem(message, haramTwo, "haramtwo.txt", 4)
|
await addItem(message, haramTwo, "haramtwo.txt", 4)
|
||||||
return
|
return
|
||||||
if (message.content.lower()[:10] == "!haramrand"):
|
if (message.content.lower()[:10] == "!haramrand"):
|
||||||
await message.reply(random.choice(lines))
|
try:
|
||||||
|
await message.reply(random.choice(lines))
|
||||||
|
except:
|
||||||
|
pass
|
||||||
return
|
return
|
||||||
if(message.author.id in admin and message.content.lower() == "!haramdel"):
|
if(message.author.id in admin and message.content.lower() == "!haramdel"):
|
||||||
if (lastHaram == 0):
|
try:
|
||||||
dellast("haramwords.txt")
|
if (lastHaram == 0):
|
||||||
await message.reply("Deleted: "+sexWords.pop())
|
dellast("haramwords.txt")
|
||||||
if (lastHaram == 1):
|
await message.reply("Deleted: "+sexWords.pop())
|
||||||
dellast("haramreg.txt")
|
if (lastHaram == 1):
|
||||||
await message.reply("Deleted: "+sexRegex.pop())
|
dellast("haramreg.txt")
|
||||||
if (lastHaram == 2):
|
await message.reply("Deleted: "+sexRegex.pop())
|
||||||
dellast("haramsis.txt")
|
if (lastHaram == 2):
|
||||||
await message.reply("Deleted: "+sisRegex.pop())
|
dellast("haramsis.txt")
|
||||||
if (lastHaram == 3):
|
await message.reply("Deleted: "+sisRegex.pop())
|
||||||
dellast("haramuser.txt")
|
if (lastHaram == 3):
|
||||||
await message.reply("Deleted: "+haramUser.pop())
|
dellast("haramuser.txt")
|
||||||
if (lastHaram == 4):
|
await message.reply("Deleted: "+haramUser.pop())
|
||||||
dellast("haramtwo.txt")
|
if (lastHaram == 4):
|
||||||
await message.reply("Deleted: "+haramTwo.pop())
|
dellast("haramtwo.txt")
|
||||||
return
|
await message.reply("Deleted: "+haramTwo.pop())
|
||||||
|
return
|
||||||
|
except:
|
||||||
|
return
|
||||||
if (message.content.lower()[:10] == "!haramlist"):
|
if (message.content.lower()[:10] == "!haramlist"):
|
||||||
if (not "\"" in message.content.lower()):
|
try:
|
||||||
msg = await message.reply("Bad syntax, no quotes")
|
if (not "\"" in message.content.lower()):
|
||||||
|
msg = await message.reply("Bad syntax, no quotes")
|
||||||
|
await asyncio.sleep(3)
|
||||||
|
await msg.delete()
|
||||||
|
return
|
||||||
|
word = message.content.lower().split("\"")[1]
|
||||||
|
if (not "," in word):
|
||||||
|
msg = await message.reply("Bad syntax, expected list number + comma + start index")
|
||||||
|
await asyncio.sleep(3)
|
||||||
|
await msg.delete()
|
||||||
|
return
|
||||||
|
list_num = word.split(",")[0].strip()
|
||||||
|
list_ind = word.split(",")[1].strip()
|
||||||
|
if not(list_num.isdigit() and list_ind.isdigit()):
|
||||||
|
msg = await message.reply("Not integers")
|
||||||
|
await asyncio.sleep(3)
|
||||||
|
await msg.delete()
|
||||||
|
return
|
||||||
|
list_num = int(list_num)
|
||||||
|
list_ind = int(list_ind)
|
||||||
|
titles = ["Haram words", "Haram regex", "Haram sis"]
|
||||||
|
if (list_num < 0 or list_num > 2):
|
||||||
|
msg = await message.reply ("Bad list")
|
||||||
|
await asyncio.sleep(3)
|
||||||
|
await msg.delete()
|
||||||
|
return
|
||||||
|
reply = "Here is a list of "+str(titles[list_num]) + " starting from "+str(list_ind)+":\n"
|
||||||
|
msg = 0
|
||||||
|
if (list_num == 0):
|
||||||
|
for i in range(list_ind, list_ind + 10):
|
||||||
|
if (i<0 or i >= len(sexWords)):
|
||||||
|
continue
|
||||||
|
reply += str(i)+". \""+sexWords[i]+"\"\n"
|
||||||
|
msg = await message.reply(reply)
|
||||||
|
elif (list_num == 1):
|
||||||
|
for i in range(list_ind, list_ind + 10):
|
||||||
|
if (i<0 or i >= len(sexRegex)):
|
||||||
|
continue
|
||||||
|
reply += str(i)+". \""+sexRegex[i]+"\"\n"
|
||||||
|
msg = await message.reply(reply)
|
||||||
|
elif (list_num == 2):
|
||||||
|
for i in range(list_ind, list_ind + 10):
|
||||||
|
if (i<0 or i >= len(sisRegex)):
|
||||||
|
continue
|
||||||
|
reply += str(i)+". \""+sisRegex[i]+"\"\n"
|
||||||
|
msg = await message.reply(reply)
|
||||||
|
else:
|
||||||
|
msg = await message.reply("Bad list")
|
||||||
await asyncio.sleep(3)
|
await asyncio.sleep(3)
|
||||||
await msg.delete()
|
await msg.delete()
|
||||||
return
|
except:
|
||||||
word = message.content.lower().split("\"")[1]
|
pass
|
||||||
if (not "," in word):
|
|
||||||
msg = await message.reply("Bad syntax, expected list number + comma + start index")
|
|
||||||
await asyncio.sleep(3)
|
|
||||||
await msg.delete()
|
|
||||||
return
|
|
||||||
list_num = word.split(",")[0].strip()
|
|
||||||
list_ind = word.split(",")[1].strip()
|
|
||||||
if not(list_num.isdigit() and list_ind.isdigit()):
|
|
||||||
msg = await message.reply("Not integers")
|
|
||||||
await asyncio.sleep(3)
|
|
||||||
await msg.delete()
|
|
||||||
return
|
|
||||||
list_num = int(list_num)
|
|
||||||
list_ind = int(list_ind)
|
|
||||||
titles = ["Haram words", "Haram regex", "Haram sis"]
|
|
||||||
if (list_num < 0 or list_num > 2):
|
|
||||||
msg = await message.reply ("Bad list")
|
|
||||||
await asyncio.sleep(3)
|
|
||||||
await msg.delete()
|
|
||||||
return
|
|
||||||
reply = "Here is a list of "+str(titles[list_num]) + " starting from "+str(list_ind)+":\n"
|
|
||||||
msg = 0
|
|
||||||
if (list_num == 0):
|
|
||||||
for i in range(list_ind, list_ind + 10):
|
|
||||||
if (i<0 or i >= len(sexWords)):
|
|
||||||
continue
|
|
||||||
reply += str(i)+". \""+sexWords[i]+"\"\n"
|
|
||||||
msg = await message.reply(reply)
|
|
||||||
elif (list_num == 1):
|
|
||||||
for i in range(list_ind, list_ind + 10):
|
|
||||||
if (i<0 or i >= len(sexRegex)):
|
|
||||||
continue
|
|
||||||
reply += str(i)+". \""+sexRegex[i]+"\"\n"
|
|
||||||
msg = await message.reply(reply)
|
|
||||||
elif (list_num == 2):
|
|
||||||
for i in range(list_ind, list_ind + 10):
|
|
||||||
if (i<0 or i >= len(sisRegex)):
|
|
||||||
continue
|
|
||||||
reply += str(i)+". \""+sisRegex[i]+"\"\n"
|
|
||||||
msg = await message.reply(reply)
|
|
||||||
else:
|
|
||||||
msg = await message.reply("Bad list")
|
|
||||||
await asyncio.sleep(3)
|
|
||||||
await msg.delete()
|
|
||||||
return
|
return
|
||||||
if (message.content.lower()[:11] == "!haramcount"):
|
if (message.content.lower()[:11] == "!haramcount"):
|
||||||
m = message.content
|
try:
|
||||||
i = str(message.author.id)
|
m = message.content
|
||||||
if ("\"" in m):
|
i = str(message.author.id)
|
||||||
i = m.split("\"")[1]
|
if ("\"" in m):
|
||||||
if i.isdigit():
|
i = m.split("\"")[1]
|
||||||
res = cur.execute(f"SELECT count FROM totals WHERE id={i}").fetchone()
|
if i.isdigit():
|
||||||
total = 0
|
res = cur.execute(f"SELECT count FROM totals WHERE id={i}").fetchone()
|
||||||
if not(res is None):
|
total = 0
|
||||||
total = res[0]
|
if not(res is None):
|
||||||
usern = await getUsername(i)
|
total = res[0]
|
||||||
if (usern is None):
|
usern = await getUsername(i)
|
||||||
await message.reply("Invalid ID")
|
if (usern is None):
|
||||||
|
await message.reply("Invalid ID")
|
||||||
|
return
|
||||||
|
await message.reply(f"User {usern} has said {total} haram things")
|
||||||
return
|
return
|
||||||
await message.reply(f"User {usern} has said {total} haram things")
|
await message.reply("Syntax Error, put user ID in quotes")
|
||||||
|
except:
|
||||||
return
|
return
|
||||||
await message.reply("Syntax Error, put user ID in quotes")
|
|
||||||
if (message.content.lower()[:10] == "!haramlast"):
|
if (message.content.lower()[:10] == "!haramlast"):
|
||||||
m = message.content
|
try:
|
||||||
i = str(message.author.id)
|
m = message.content
|
||||||
if ("\"" in m):
|
i = str(message.author.id)
|
||||||
i = m.split("\"")[1]
|
if ("\"" in m):
|
||||||
if i.isdigit():
|
i = m.split("\"")[1]
|
||||||
res = cur.execute(f"SELECT lastharam FROM totals WHERE id={i}").fetchone()
|
if i.isdigit():
|
||||||
lh = ""
|
res = cur.execute(f"SELECT lastharam FROM totals WHERE id={i}").fetchone()
|
||||||
if not(res is None):
|
lh = ""
|
||||||
lh = res[0]
|
if not(res is None):
|
||||||
usern = await getUsername(i)
|
lh = res[0]
|
||||||
if (usern is None):
|
usern = await getUsername(i)
|
||||||
await message.reply("Invalid ID")
|
if (usern is None):
|
||||||
|
await message.reply("Invalid ID")
|
||||||
|
return
|
||||||
|
await message.reply(f"User {usern} has last said: {lh}")
|
||||||
return
|
return
|
||||||
await message.reply(f"User {usern} has last said: {lh}")
|
await message.reply("Syntax Error, put user ID in quotes")
|
||||||
|
except:
|
||||||
return
|
return
|
||||||
await message.reply("Syntax Error, put user ID in quotes")
|
|
||||||
|
|
||||||
if (message.content == "!haramtop"):
|
if (message.content == "!haramtop"):
|
||||||
res = cur.execute("SELECT id, count FROM totals ORDER BY count DESC LIMIT 10").fetchall()
|
res = cur.execute("SELECT id, count FROM totals ORDER BY count DESC LIMIT 10").fetchall()
|
||||||
@ -274,7 +555,11 @@ async def on_message(message):
|
|||||||
if (user is None):
|
if (user is None):
|
||||||
continue
|
continue
|
||||||
msg = msg + f"{user}: {i[1]} harams\n"
|
msg = msg + f"{user}: {i[1]} harams\n"
|
||||||
await message.reply(msg)
|
try:
|
||||||
|
await message.reply(msg)
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
return
|
||||||
author = message.author.id
|
author = message.author.id
|
||||||
cleanedStr = cleanString(message.content.lower())
|
cleanedStr = cleanString(message.content.lower())
|
||||||
#stop it from fucking around if it looking at its own message
|
#stop it from fucking around if it looking at its own message
|
||||||
@ -285,22 +570,31 @@ async def on_message(message):
|
|||||||
#1984 feature could be added here ;)
|
#1984 feature could be added here ;)
|
||||||
for word in sexWords:
|
for word in sexWords:
|
||||||
if (word in message.content.lower() or word in cleanedStr):
|
if (word in message.content.lower() or word in cleanedStr):
|
||||||
msg = await message.reply("<:gogetmarried:1204950895217999984>")
|
|
||||||
increment(message.author.id, word)
|
increment(message.author.id, word)
|
||||||
|
try:
|
||||||
|
msg = await message.reply("<:gogetmarried:1204950895217999984>")
|
||||||
|
except:
|
||||||
|
return
|
||||||
await asyncio.sleep(3)
|
await asyncio.sleep(3)
|
||||||
await msg.delete()
|
await msg.delete()
|
||||||
return
|
return
|
||||||
for reg in sexRegex:
|
for reg in sexRegex:
|
||||||
if (re.search(reg," "+ message.content.lower()+" ") or message.author.id in haram_users):
|
if (re.search(reg," "+ message.content.lower()+" ") or message.author.id in haram_users):
|
||||||
msg = await message.reply("<:gogetmarried:1204950895217999984>")
|
|
||||||
increment(message.author.id, "Regex: "+reg)
|
increment(message.author.id, "Regex: "+reg)
|
||||||
|
try:
|
||||||
|
msg = await message.reply("<:gogetmarried:1204950895217999984>")
|
||||||
|
except:
|
||||||
|
return
|
||||||
await asyncio.sleep(3)
|
await asyncio.sleep(3)
|
||||||
await msg.delete()
|
await msg.delete()
|
||||||
return
|
return
|
||||||
for reg in sisRegex:
|
for reg in sisRegex:
|
||||||
if (re.search(" sis.*"+reg," "+ message.content.lower()+" ") or re.search(reg+".* sis", " "+message.content.lower()+" ")):
|
if (re.search(" sis.*"+reg," "+ message.content.lower()+" ") or re.search(reg+".* sis", " "+message.content.lower()+" ")):
|
||||||
msg = await message.reply("<:gogetmarried:1204950895217999984>")
|
|
||||||
increment(message.author.id, "Sis: "+reg)
|
increment(message.author.id, "Sis: "+reg)
|
||||||
|
try:
|
||||||
|
msg = await message.reply("<:gogetmarried:1204950895217999984>")
|
||||||
|
except:
|
||||||
|
return
|
||||||
await asyncio.sleep(3)
|
await asyncio.sleep(3)
|
||||||
await msg.delete()
|
await msg.delete()
|
||||||
return
|
return
|
||||||
@ -308,12 +602,18 @@ async def on_message(message):
|
|||||||
for reg in haramTwo:
|
for reg in haramTwo:
|
||||||
if (re.search(reg," "+message.content.lower()+" ")):
|
if (re.search(reg," "+message.content.lower()+" ")):
|
||||||
increment(message.author.id, "Haram2: "+reg)
|
increment(message.author.id, "Haram2: "+reg)
|
||||||
msg = await message.reply("<:gogetmarried:1204950895217999984>")
|
try:
|
||||||
|
msg = await message.reply("<:gogetmarried:1204950895217999984>")
|
||||||
|
except:
|
||||||
|
return
|
||||||
await asyncio.sleep(3)
|
await asyncio.sleep(3)
|
||||||
await msg.delete()
|
await msg.delete()
|
||||||
return
|
return
|
||||||
if (message.content.lower() == "go get married"):
|
if (message.content.lower() in ["go get married", "gogetmarried"]):
|
||||||
await message.reply("<:halal:1204949791717457940>")
|
try:
|
||||||
|
await message.reply("<:halal:1204949791717457940>")
|
||||||
|
except:
|
||||||
|
pass
|
||||||
return
|
return
|
||||||
if ("pipi" in message.content.lower()):
|
if ("pipi" in message.content.lower()):
|
||||||
msg = await message.channel.send("""Are you kidding ??? What the \\*\\*\\*\\* are you talking about man ? You are a biggest looser i ever seen in my life ! You was doing PIPI in your pampers when i was beating players much more stronger then you! You are not proffesional, because proffesionals knew how to lose and congratulate opponents, you are like a girl crying after i beat you! Be brave, be honest to yourself and stop this trush talkings!!! Everybody know that i am very good blitz player, i can win anyone in the world in single game! And \"w\"esley \"s\"o is nobody for me, just a player who are crying every single time when loosing, ( remember what you say about Firouzja ) !!! Stop playing with my name, i deserve to have a good name during whole my chess carrier, I am Officially inviting you to OTB blitz match with the Prize fund! Both of us will invest 5000$ and winner takes it all!
|
msg = await message.channel.send("""Are you kidding ??? What the \\*\\*\\*\\* are you talking about man ? You are a biggest looser i ever seen in my life ! You was doing PIPI in your pampers when i was beating players much more stronger then you! You are not proffesional, because proffesionals knew how to lose and congratulate opponents, you are like a girl crying after i beat you! Be brave, be honest to yourself and stop this trush talkings!!! Everybody know that i am very good blitz player, i can win anyone in the world in single game! And \"w\"esley \"s\"o is nobody for me, just a player who are crying every single time when loosing, ( remember what you say about Firouzja ) !!! Stop playing with my name, i deserve to have a good name during whole my chess carrier, I am Officially inviting you to OTB blitz match with the Prize fund! Both of us will invest 5000$ and winner takes it all!
|
||||||
@ -332,6 +632,10 @@ I suggest all other people who's intrested in this situation, just take a look a
|
|||||||
fort = subprocess.run(["fortune" , "-a"], stdout=subprocess.PIPE, text=True)
|
fort = subprocess.run(["fortune" , "-a"], stdout=subprocess.PIPE, text=True)
|
||||||
await message.channel.send("```\n"+fort.stdout+"```")
|
await message.channel.send("```\n"+fort.stdout+"```")
|
||||||
return
|
return
|
||||||
|
if (message.content.lower() == "!gpustats"):
|
||||||
|
fort = subprocess.run(["nvidia-smi"], stdout=subprocess.PIPE, text=True)
|
||||||
|
await message.channel.send("```\n"+fort.stdout+"```")
|
||||||
|
return
|
||||||
if ("asciiart" in message.content.lower()):
|
if ("asciiart" in message.content.lower()):
|
||||||
fort = subprocess.run(["fortune", "mario.arteascii"], stdout=subprocess.PIPE, text=True)
|
fort = subprocess.run(["fortune", "mario.arteascii"], stdout=subprocess.PIPE, text=True)
|
||||||
#cow = subprocess.run(["cowthink", "-n"], stdin=fort.stdout, stdout=subprocess.PIPE, text=True)
|
#cow = subprocess.run(["cowthink", "-n"], stdin=fort.stdout, stdout=subprocess.PIPE, text=True)
|
||||||
@ -359,7 +663,10 @@ There really is a Linux, and these people are using it, but it is just a part of
|
|||||||
|
|
||||||
# femboy
|
# femboy
|
||||||
if "femboy" in message.content.lower():
|
if "femboy" in message.content.lower():
|
||||||
await message.reply("says the femboy")
|
try:
|
||||||
|
await message.reply("says the femboy")
|
||||||
|
except:
|
||||||
|
pass
|
||||||
return
|
return
|
||||||
|
|
||||||
#check if we are in the right channel
|
#check if we are in the right channel
|
||||||
@ -397,4 +704,5 @@ There really is a Linux, and these people are using it, but it is just a part of
|
|||||||
|
|
||||||
await message.channel.send(chatbotOutput)
|
await message.channel.send(chatbotOutput)
|
||||||
"""
|
"""
|
||||||
|
print(os.environ.get('TOKEN'))
|
||||||
client.run(os.environ.get('TOKEN'))
|
client.run(os.environ.get('TOKEN'))
|
||||||
|
@ -12,3 +12,4 @@ ben(t|d|ding) over
|
|||||||
(s|5)(e|3)x
|
(s|5)(e|3)x
|
||||||
tit[stiy]
|
tit[stiy]
|
||||||
rule.?34
|
rule.?34
|
||||||
|
jerk.?.?.? off
|
||||||
|
@ -322,3 +322,9 @@ boymod
|
|||||||
cunnie
|
cunnie
|
||||||
cunnilingus
|
cunnilingus
|
||||||
bronie
|
bronie
|
||||||
|
vag
|
||||||
|
viagra cialis
|
||||||
|
knocker
|
||||||
|
knocked up
|
||||||
|
tidd
|
||||||
|
cok
|
||||||
|
Loading…
Reference in New Issue
Block a user