mirror of
https://github.com/migatu/conjurer.git
synced 2026-07-15 14:22:13 +00:00
Additional lines of code
This commit is contained in:
@@ -453,6 +453,20 @@ async def play(ctx, zamawial=None, arg=None):
|
|||||||
await ctx.send(result)
|
await ctx.send(result)
|
||||||
|
|
||||||
|
|
||||||
|
async def archive_channel(channel_no):
|
||||||
|
channel = client.get_channel(channel_no)
|
||||||
|
messages = [message async for message in channel.history(limit=None)]
|
||||||
|
path_newfile = (
|
||||||
|
f"{LOGSTORE}channeldump_{channel_no}_{datetime.now()}.json"
|
||||||
|
)
|
||||||
|
new_data = []
|
||||||
|
for message in messages:
|
||||||
|
pass
|
||||||
|
with open(path_newfile, "x", encoding=ENCODING) as new_file:
|
||||||
|
new_file.seek(0)
|
||||||
|
json.dump(new_data, new_file, indent=4)
|
||||||
|
|
||||||
|
|
||||||
async def check():
|
async def check():
|
||||||
"""Funkcja sprawdzająca czy grać następny kawałek."""
|
"""Funkcja sprawdzająca czy grać następny kawałek."""
|
||||||
while True:
|
while True:
|
||||||
|
|||||||
@@ -0,0 +1,33 @@
|
|||||||
|
import netrc
|
||||||
|
|
||||||
|
import psycopg2
|
||||||
|
|
||||||
|
NETRC_FILE = ""
|
||||||
|
NETRC_FILE = "/home/mtuszowski/.netrc"
|
||||||
|
# NETRC_FILE = "/home/pi/.netrc"
|
||||||
|
# NETRC_FILE = "C:\\Users\\mtusz\\.netrc"
|
||||||
|
|
||||||
|
netrc_mod = netrc.netrc(NETRC_FILE)
|
||||||
|
REMOTE_HOST_NAME = "sql_localhost"
|
||||||
|
authTokens = netrc_mod.authenticators(REMOTE_HOST_NAME)
|
||||||
|
|
||||||
|
# Connect to your postgres DB
|
||||||
|
conn = psycopg2.connect(
|
||||||
|
database="scihubdois",
|
||||||
|
host="localhost",
|
||||||
|
# trunk-ignore(mypy/index)
|
||||||
|
user=authTokens[0],
|
||||||
|
# trunk-ignore(mypy/index)
|
||||||
|
password=authTokens[2],
|
||||||
|
port="5432",
|
||||||
|
)
|
||||||
|
|
||||||
|
# Open a cursor to perform database operations
|
||||||
|
cur = conn.cursor()
|
||||||
|
|
||||||
|
# Execute a query
|
||||||
|
cur.execute("SELECT * FROM version()")
|
||||||
|
|
||||||
|
# Retrieve query results
|
||||||
|
records = cur.fetchall()
|
||||||
|
print(records)
|
||||||
Reference in New Issue
Block a user