Ajout !pinguncon et débuts autres trucs
This commit is contained in:
parent
cdff52af88
commit
571754086a
4 changed files with 30 additions and 7 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -1,4 +1,4 @@
|
||||||
start.sh
|
secrets.txt
|
||||||
|
|
||||||
# Byte-compiled / optimized / DLL files
|
# Byte-compiled / optimized / DLL files
|
||||||
__pycache__/
|
__pycache__/
|
||||||
|
|
5
db.py
Normal file
5
db.py
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
import psycopg
|
||||||
|
|
||||||
|
#filled in at runtime
|
||||||
|
credentials = ""
|
||||||
|
|
29
ecoplus.py
29
ecoplus.py
|
@ -1,6 +1,18 @@
|
||||||
import sys
|
import sys
|
||||||
import discord
|
import discord
|
||||||
|
|
||||||
|
import db
|
||||||
|
|
||||||
|
secrets_file = open(sys.argv[1], mode="rt")
|
||||||
|
|
||||||
|
secrets = secrets_file.read()
|
||||||
|
|
||||||
|
secrets = secrets.split(";")
|
||||||
|
|
||||||
|
token = secrets[0]
|
||||||
|
|
||||||
|
db.credentials = secrets[1]
|
||||||
|
|
||||||
intents = discord.Intents.default()
|
intents = discord.Intents.default()
|
||||||
intents.message_content = True
|
intents.message_content = True
|
||||||
|
|
||||||
|
@ -8,14 +20,19 @@ client = discord.Client(intents=intents)
|
||||||
|
|
||||||
@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}')
|
||||||
|
|
||||||
@client.event
|
@client.event
|
||||||
async def on_message(message):
|
async def on_message(message):
|
||||||
if message.author == client.user:
|
if message.author == client.user:
|
||||||
return
|
return
|
||||||
|
|
||||||
if message.content.startswith('$hello'):
|
content = message.content
|
||||||
await message.channel.send('Hello!')
|
|
||||||
|
|
||||||
client.run(str(sys.argv[1]))
|
if content == "!hello":
|
||||||
|
await message.channel.send('henlo')
|
||||||
|
return
|
||||||
|
if content == "!pinguncon":
|
||||||
|
await message.channel.send("<499533339468759052>")
|
||||||
|
|
||||||
|
client.run(token)
|
||||||
|
|
1
start.sh
Normal file
1
start.sh
Normal file
|
@ -0,0 +1 @@
|
||||||
|
python3 ecoplus.py secrets.txt
|
Loading…
Add table
Reference in a new issue