-
Notifications
You must be signed in to change notification settings - Fork 0
/
data.py
101 lines (86 loc) · 1.9 KB
/
data.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
import sqlite3, datetime
from datetime import datetime
def send(message):
now = datetime.now()
connection = sqlite3.connect("Database/data.db")
cursor = connection.cursor()
cursor.execute('''CREATE TABLE IF NOT EXISTS Send(
user_name,
user_id,
method,
content,
"date",
"time")''')
cursor.execute('''INSERT INTO Send(
user_name,
user_id,
method,
content,
"date",
"time")
VALUES (?, ?, ?, ?, ?, ?)''', (
message.author.name,
message.author.id,
"send",
message.content,
now.strftime("%Y:%m:%d"),
now.strftime("%H:%M:%S")))
connection.commit()
connection.close()
def delete(message):
now = datetime.now()
connection = sqlite3.connect("Database/data.db")
cursor = connection.cursor()
cursor.execute('''CREATE TABLE IF NOT EXISTS "Delete"(
user_name,
user_id,
method,
content,
"date",
"time")''')
cursor.execute('''INSERT INTO "Delete"(
user_name,
user_id,
method,
content,
"date",
"time")
VALUES (?, ?, ?, ?, ?, ?)''', (
message.author.name,
message.author.id,
"delete",
message.content,
now.strftime("%Y:%m:%d"),
now.strftime("%H:%M:%S")))
connection.commit()
connection.close()
def edit(before, after):
now = datetime.now()
connection = sqlite3.connect("Database/data.db")
cursor = connection.cursor()
cursor.execute('''CREATE TABLE IF NOT EXISTS Edit(
user_name,
user_id,
method,
before,
after,
"date",
"time")''')
cursor.execute('''INSERT INTO Edit(
user_name,
user_id,
method,
before,
after,
"date",
"time")
VALUES (?, ?, ?, ?, ?, ?, ?)''', (
after.author.name,
after.author.id,
"edit",
before.content,
after.content,
now.strftime("%Y:%m:%d"),
now.strftime("%H:%M:%S")))
connection.commit()
connection.close()