Compare commits
10 commits
571754086a
...
10ca3586f0
Author | SHA1 | Date | |
---|---|---|---|
|
10ca3586f0 | ||
|
3e0a68a9df | ||
|
d3c8829626 | ||
|
eab9b9913c | ||
|
b396269a54 | ||
|
7575ed14a4 | ||
|
adb74bd964 | ||
|
d030275103 | ||
|
426493cdc5 | ||
|
f5839ff6b5 |
6 changed files with 187 additions and 18 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -1,4 +1,5 @@
|
||||||
secrets.txt
|
secrets.txt
|
||||||
|
*.db
|
||||||
|
|
||||||
# Byte-compiled / optimized / DLL files
|
# Byte-compiled / optimized / DLL files
|
||||||
__pycache__/
|
__pycache__/
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
# Eco_plus
|
# Eco_plus
|
||||||
Mon bot discord fait avec mes petites mains
|
Mon bot discord fait avec mes petites mains
|
||||||
|
|
||||||
Utilise discord.py et c'est tout
|
Utilise discord.py, psycopg et c'est tout
|
||||||
|
|
5
db.py
5
db.py
|
@ -1,5 +0,0 @@
|
||||||
import psycopg
|
|
||||||
|
|
||||||
#filled in at runtime
|
|
||||||
credentials = ""
|
|
||||||
|
|
196
ecoplus.py
196
ecoplus.py
|
@ -1,26 +1,193 @@
|
||||||
import sys
|
import sys
|
||||||
|
import random
|
||||||
import discord
|
import discord
|
||||||
|
import datetime
|
||||||
|
|
||||||
import db
|
import sqlite3
|
||||||
|
|
||||||
|
database = sqlite3.connect("bdd.db")
|
||||||
|
cursor = database.cursor()
|
||||||
|
|
||||||
|
try:
|
||||||
|
cursor.execute("CREATE TABLE casino (id INT PRIMARY KEY, cash INT)")
|
||||||
|
database.commit()
|
||||||
|
except:
|
||||||
|
print("La table existe déja")
|
||||||
|
|
||||||
secrets_file = open(sys.argv[1], mode="rt")
|
secrets_file = open(sys.argv[1], mode="rt")
|
||||||
|
|
||||||
secrets = secrets_file.read()
|
secrets = secrets_file.read()
|
||||||
|
secrets_file.close()
|
||||||
|
|
||||||
secrets = secrets.split(";")
|
token = secrets
|
||||||
|
|
||||||
token = secrets[0]
|
|
||||||
|
|
||||||
db.credentials = secrets[1]
|
|
||||||
|
|
||||||
intents = discord.Intents.default()
|
intents = discord.Intents.default()
|
||||||
intents.message_content = True
|
intents.message_content = True
|
||||||
|
intents.members = True
|
||||||
|
intents.moderation = True
|
||||||
|
|
||||||
client = discord.Client(intents=intents)
|
client = discord.Client(intents=intents, activity=discord.Game(name='En train de niquer des mères'))
|
||||||
|
|
||||||
|
guilds = []
|
||||||
|
|
||||||
|
globals()["gmembers"] = {}
|
||||||
|
|
||||||
|
async def pinguncon(message):
|
||||||
|
#fcalva's server
|
||||||
|
if message.guild.id == 750665878072328242:
|
||||||
|
await message.channel.send("<@499533339468759052>")
|
||||||
|
elif message.guild.id in [1008485562304450610, 1157767629738618941]:
|
||||||
|
await message.channel.send("<@755081785393676328>")
|
||||||
|
elif message.guild.id == 1294017120631525416:
|
||||||
|
await message.channel.send("<@504751919760408617>")
|
||||||
|
else:
|
||||||
|
await message.channel.send("Pas dispo ici")
|
||||||
|
|
||||||
|
async def pingjuif(message):
|
||||||
|
if message.guild.id in [1008485562304450610, 1157767629738618941]:
|
||||||
|
await message.channel.send("<@459021187083927553>")
|
||||||
|
else:
|
||||||
|
message.channel.send("Pas dispo ici")
|
||||||
|
|
||||||
|
async def pingrand(message):
|
||||||
|
choice = random.choice(globals()["gmembers"][str(message.guild.id)])
|
||||||
|
await message.channel.send("<@"+str(choice.id)+">")
|
||||||
|
|
||||||
|
async def roulette(message):
|
||||||
|
roll = random.random()
|
||||||
|
if roll < 0.16666666666:
|
||||||
|
tdelt = datetime.timedelta(minutes=1)
|
||||||
|
await message.author.timeout(tdelt, reason="Vous avez perdu à la roulette...")
|
||||||
|
try:
|
||||||
|
await message.author.timeout(tdelt, reason="Vous avez perdu à la roulette...")
|
||||||
|
except:
|
||||||
|
await message.channel.send("Une erreur s'est produite ! (Je ne peux probablement pas vous timeout)")
|
||||||
|
else:
|
||||||
|
await message.channel.send("Ouf ! Il n'y avait pas de cartouche dans la chambre...")
|
||||||
|
|
||||||
|
async def casino_init(message):
|
||||||
|
usrid = int(message.author.id)
|
||||||
|
try:
|
||||||
|
cursor.execute(f"INSERT INTO casino (id, cash) VALUES ({usrid}, 0)")
|
||||||
|
database.commit()
|
||||||
|
await message.channel.send(f"Casino initialisé pour <@{usrid}>")
|
||||||
|
except:
|
||||||
|
await message.channel.send(f"Échec ! Réessayez plus tard")
|
||||||
|
|
||||||
|
async def balance(message):
|
||||||
|
usrid = int(message.author.id)
|
||||||
|
cash = cursor.execute(f"SELECT cash FROM casino WHERE id={usrid}").fetchone()
|
||||||
|
if cash:
|
||||||
|
await message.channel.send(f"Vous avez {cash[0]}$")
|
||||||
|
else:
|
||||||
|
await message.channel.send(f"Essayez d'initialiser votre portemonnaie avec ?init")
|
||||||
|
|
||||||
|
async def collect(message):
|
||||||
|
collect_gain = 50
|
||||||
|
usrid = int(message.author.id)
|
||||||
|
cash = cursor.execute(f"SELECT cash FROM casino WHERE id={usrid}").fetchone()
|
||||||
|
if cash != None:
|
||||||
|
cash = cash[0]
|
||||||
|
cash += collect_gain
|
||||||
|
cursor.execute(f"UPDATE casino SET cash = {cash} WHERE id={usrid}")
|
||||||
|
database.commit()
|
||||||
|
await message.channel.send(f"Vous avez recu {collect_gain}$. Vous avez désormais {cash}$")
|
||||||
|
else:
|
||||||
|
await message.channel.send(f"Essayez d'initialiser votre portemonnaie avec ?init")
|
||||||
|
|
||||||
|
async def ecoaide(message):
|
||||||
|
await message.channel.send("Eco+, un bot Eco plus pour faire des conneries\n"\
|
||||||
|
"?pinguncon : Ping le con local\n"\
|
||||||
|
"?pingunjuif : Ping le juif local\n"\
|
||||||
|
"?pingrand : Ping un membre aléatoire du serveur\n"
|
||||||
|
"?roulette : Prennez une chance sur six de vous faire timeout")
|
||||||
|
|
||||||
|
async def ecohelp(message):
|
||||||
|
await message.channel.send("Eco+ help page \n"\
|
||||||
|
"?pinguncon : Ping the local dumbass\n"\
|
||||||
|
"?pingrand : Ping a random user\n"\
|
||||||
|
"?roulette : Take one shot on six to get timed out")
|
||||||
|
|
||||||
|
async def hello(message):
|
||||||
|
await message.channel.send('henlo')
|
||||||
|
|
||||||
|
commentaires_zizi = [
|
||||||
|
#0
|
||||||
|
["Vous avez essayé de mesurer à la base ?","Dur d'avoir des chromosomes XX. Retourne à la cuisine"],\
|
||||||
|
#1
|
||||||
|
["J'ai pitié.", "Échec critique !"],\
|
||||||
|
#2
|
||||||
|
["Tu peux toujours te dire que la taille ne compte pas"],\
|
||||||
|
#3
|
||||||
|
["Dire que c'était ma taille à trois ans..."],\
|
||||||
|
#4
|
||||||
|
["Retourne dans ton 4x4 micropénis"],\
|
||||||
|
#5
|
||||||
|
["En impérial, ça aurait été la moyenne"],\
|
||||||
|
#6
|
||||||
|
["T'es pas la bite la plus dure du gloryhole"],\
|
||||||
|
#7
|
||||||
|
[""],\
|
||||||
|
#8
|
||||||
|
[""],\
|
||||||
|
#9
|
||||||
|
[""],\
|
||||||
|
#10
|
||||||
|
[""],\
|
||||||
|
#11
|
||||||
|
[""],\
|
||||||
|
#12
|
||||||
|
[""],\
|
||||||
|
#13
|
||||||
|
["La moyenne, pour de vrai"],\
|
||||||
|
#14
|
||||||
|
[""],\
|
||||||
|
#15
|
||||||
|
[""],\
|
||||||
|
#16
|
||||||
|
["La verité est dure à avaler"],\
|
||||||
|
#17
|
||||||
|
["C'est roc, c'est un pic, c'est un cap. Que dis-je ? C'est une péninsule"],\
|
||||||
|
#18
|
||||||
|
["Si le goût se rapporte à la taille, vous êtes le phoenix des hôtes du gang bang"],\
|
||||||
|
#19
|
||||||
|
["Bien membré !"],\
|
||||||
|
#20
|
||||||
|
["Je veux la même !", "Coup critique !"],\
|
||||||
|
#21
|
||||||
|
["Profite de tes chromosomes YY :moai:", "La taille moyenne en Uganda"]
|
||||||
|
]
|
||||||
|
|
||||||
|
async def zizi(message):
|
||||||
|
id = message.author.id
|
||||||
|
size = random.randint(0,21)
|
||||||
|
comment = random.choice(commentaires_zizi[size])
|
||||||
|
await message.channel.send(f"<@{id}>, votre chibre fait **{size} cm**. {comment}")
|
||||||
|
|
||||||
@client.event
|
@client.event
|
||||||
async def on_ready():
|
async def on_ready():
|
||||||
print(f'We have logged in as {client.user}')
|
print(f'We have logged in as {client.user}')
|
||||||
|
async for guild in client.fetch_guilds(limit=150):
|
||||||
|
print(str(guild.id)+":")
|
||||||
|
guilds.append(guild)
|
||||||
|
sid = str(guild.id)
|
||||||
|
globals()["gmembers"] |= {sid:[]}
|
||||||
|
async for member in guild.fetch_members(limit=150):
|
||||||
|
globals()["gmembers"][sid].append(member)
|
||||||
|
print(" "+str(member))
|
||||||
|
|
||||||
|
cmd_dict = {\
|
||||||
|
"?hello":hello,\
|
||||||
|
"?pinguncon":pinguncon,\
|
||||||
|
"?pingrand":pingrand,\
|
||||||
|
"?pingunjuif":pingjuif,\
|
||||||
|
"?zizi":zizi,\
|
||||||
|
"?roulette":roulette,\
|
||||||
|
"?help":ecohelp,\
|
||||||
|
"?aide":ecoaide,\
|
||||||
|
"?init":casino_init,\
|
||||||
|
"?cash":balance,\
|
||||||
|
"?collect":collect,\
|
||||||
|
}
|
||||||
|
|
||||||
@client.event
|
@client.event
|
||||||
async def on_message(message):
|
async def on_message(message):
|
||||||
|
@ -29,10 +196,15 @@ async def on_message(message):
|
||||||
|
|
||||||
content = message.content
|
content = message.content
|
||||||
|
|
||||||
if content == "!hello":
|
if not content:
|
||||||
await message.channel.send('henlo')
|
|
||||||
return
|
return
|
||||||
if content == "!pinguncon":
|
if content[0] != "?":
|
||||||
await message.channel.send("<499533339468759052>")
|
return
|
||||||
|
|
||||||
|
try:
|
||||||
|
await cmd_dict[content](message)
|
||||||
|
except Exception as err:
|
||||||
|
print(err)
|
||||||
|
await message.channel.send("Commande non reconnue !")
|
||||||
|
|
||||||
client.run(token)
|
client.run(token)
|
||||||
|
|
0
start.sh
Normal file → Executable file
0
start.sh
Normal file → Executable file
1
update.sh
Normal file
1
update.sh
Normal file
|
@ -0,0 +1 @@
|
||||||
|
git pull https://github.com/attilavs2/EcoPlus-temp-
|
Loading…
Add table
Reference in a new issue