forked from Seniru/wtal-bot
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
147 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
-- MySQL dump 10.13 Distrib 8.0.33, for Linux (x86_64) | ||
-- | ||
-- Host: sql9.freesqldatabase.com Database: sql9617855 | ||
-- ------------------------------------------------------ | ||
-- Server version 5.5.62-0ubuntu0.14.04.1 | ||
|
||
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; | ||
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; | ||
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; | ||
/*!50503 SET NAMES utf8mb4 */; | ||
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; | ||
/*!40103 SET TIME_ZONE='+00:00' */; | ||
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; | ||
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; | ||
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; | ||
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; | ||
|
||
-- | ||
-- Table structure for table `CustomCommands` | ||
-- | ||
|
||
DROP TABLE IF EXISTS `CustomCommands`; | ||
/*!40101 SET @saved_cs_client = @@character_set_client */; | ||
/*!50503 SET character_set_client = utf8mb4 */; | ||
CREATE TABLE IF NOT EXISTS `CustomCommands` ( | ||
`name` varchar(15) NOT NULL, | ||
`runner` varchar(20) NOT NULL, | ||
`source` varchar(40) NOT NULL, | ||
`author` bigint(20), | ||
PRIMARY KEY (`name`) | ||
) ENGINE=InnoDB DEFAULT CHARSET=latin1; | ||
/*!40101 SET character_set_client = @saved_cs_client */; | ||
|
||
-- | ||
-- Dumping data for table `CustomCommands` | ||
-- | ||
|
||
LOCK TABLES `CustomCommands` WRITE; | ||
/*!40000 ALTER TABLE `CustomCommands` DISABLE KEYS */; | ||
INSERT INTO `CustomCommands` VALUES ('8ball','cpython-3.8.9','https://pastebin.com/raw/ExMLuAgv','544776631672242176'),('coinflip','cpython-3.8.9','https://pastebin.com/raw/f8v5EGQF','544776631672242176'),('death','cpython-3.8.9','https://pastebin.com/raw/nLtRfDhs','544776631672242176'),('dice','cpython-3.8.9','https://pastebin.com/raw/LmxRAKE1','544776631672242176'),('dog','cpython-3.8.9','https://pastebin.com/raw/bijXTmat','544776631672242176'),('embed','cpython-3.8.9','https://pastebin.com/raw/AbPX16PA','522972601488900097'),('frog','cpython-3.8.9','https://pastebin.com/raw/bwpCSAvi','544776631672242176'),('graph','cpython-3.8.9','https://pastebin.com/raw/YH0YyPAk','522972601488900097'),('howto','cpython-3.8.9','https://pastebin.com/raw/amMuvd1B','522972601488900097'),('no','cpython-3.8.9','https://pastebin.com/raw/tvprgEqC','522972601488900097'),('order','cpython-3.8.9','https://pastebin.com/raw/B38n572h','544776631672242176'),('percentage','cpython-3.8.9','https://pastebin.com/raw/QghKi731','544776631672242176'),('raw','cpython-3.8.9','https://pastebin.com/raw/Mqq8TkXT','522972601488900097'),('ricardo','cpython-3.8.9','https://pastebin.com/raw/3LRJ8Q6A','522972601488900097'),('tex','cpython-3.8.9','https://pastebin.com/raw/hE2W5YKs','522972601488900097'),('worldclock','cpython-3.8.9','https://pastebin.com/raw/yBueDaSJ','522972601488900097'),('yes','cpython-3.8.9','https://pastebin.com/raw/UguBK6yg','544776631672242176'); | ||
/*!40000 ALTER TABLE `CustomCommands` ENABLE KEYS */; | ||
UNLOCK TABLES; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
FROM mysql:5.7 | ||
|
||
WORKDIR /database | ||
|
||
ADD *.sql /docker-entrypoint-initdb.d/ | ||
ADD /run-til-midnight.sh / | ||
RUN chmod +x /run-til-midnight.sh | ||
|
||
EXPOSE 3306 | ||
ENTRYPOINT ["docker-entrypoint.sh"] | ||
CMD ["/run-til-midnight.sh", "mysqld"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
CREATE TABLE IF NOT EXISTS `Warnings` ( | ||
`member` bigint(20) NOT NULL | ||
`reason` varchar(100) DEFAULT NULL, | ||
) ENGINE=InnoDB DEFAULT CHARSET=latin1; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
CREATE TABLE IF NOT EXISTS `QOTD` ( | ||
`id` int NOT NULL, | ||
`question` VARCHAR(200) NOT NULL | ||
PRIMARY KEY (`id`) | ||
) ENGINE=InnoDB DEFAULT CHARSET=latin1; | ||
|
||
CREATE TABLE IF NOT EXISTS `QOTData` ( | ||
`kind` CHAR(5) NOT NULL, | ||
`value` VARCHAR(20) NOT NULL | ||
) ENGINE=InnoDB DEFAULT CHARSET=latin1; | ||
|
||
INSERT INTO `QOTData` | ||
VALUES('latest', '$current_time') | ||
ON DUPLICATE KEY IGNORE; | ||
|
||
INSERT INTO `QOTData` | ||
VALUES('index', '0') | ||
ON DUPLICATE KEY IGNORE; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
while true | ||
do | ||
# Run until midnight | ||
midnight=$(date -d 'tomorrow 00:05:00' +%s) | ||
now=$(date +%s) | ||
seconds=$(($midnight - $now)) | ||
timeout --preserve-status ${seconds}s "$@" | ||
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,27 @@ | ||
version: "3.3" | ||
services: | ||
db: | ||
container_name: db | ||
build: ./database | ||
restart: always | ||
ports: | ||
- 3306:3306 | ||
environment: | ||
MYSQL_DATABASE: db | ||
MYSQL_USER: user | ||
MYSQL_PASSWORD: password | ||
MYSQL_ROOT_PASSWORD: root | ||
volumes: | ||
- my-db:/var/lib/mysql | ||
|
||
bot: | ||
container_name: bot | ||
depends_on: | ||
- db | ||
build: . | ||
env_file: ./.env | ||
working_dir: /src | ||
volumes: | ||
- ./:/src | ||
volumes: | ||
my-db: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,7 @@ | ||
#!/bin/bash | ||
|
||
sh /wait-for-it.sh "db:3306" --timeout=60 | ||
|
||
function run() { | ||
python -u src/main.py || run | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,38 @@ | ||
import os | ||
import asyncio | ||
|
||
from bots.Transformice import Transformice | ||
#sys.path.append("discordslashcommands") | ||
from bots.Discord import Discord | ||
|
||
print("[INFO][SYSTME] Starting...") | ||
import aiomysql | ||
async def test(): | ||
import json | ||
aiomysql.create_pool() | ||
conn = await aiomysql.connect(host="db", user="user", db="db", password="password", port=3306) | ||
cur = await conn.cursor() | ||
|
||
await cur.execute("select * from test;") | ||
r = await cur.fetchall() | ||
print(r) | ||
await conn.commit() | ||
await cur.close() | ||
conn.close() | ||
|
||
loop = asyncio.get_event_loop() | ||
|
||
discord = Discord() | ||
tfm = Transformice(os.getenv("USERNAME"), os.getenv("PASSWORD"), loop, discord) | ||
|
||
discord.set_tfm_instance(tfm) | ||
|
||
print("[INFO][DISCORD] Starting...") | ||
loop.create_task(discord.start(os.getenv("DISCORD"))) | ||
tfm.run() | ||
loop.run_forever() | ||
loop.run_until_complete(test()) | ||
loop.run_forever() | ||
#from bots.Transformice import Transformice | ||
##sys.path.append("discordslashcommands") | ||
#from bots.Discord import Discord | ||
# | ||
#print("[INFO][SYSTME] Starting...") | ||
# | ||
#loop = asyncio.get_event_loop() | ||
# | ||
#discord = Discord() | ||
#tfm = Transformice(os.getenv("USERNAME"), os.getenv("PASSWORD"), loop, discord) | ||
# | ||
#discord.set_tfm_instance(tfm) | ||
# | ||
#print("[INFO][DISCORD] Starting...") | ||
#loop.create_task(discord.start(os.getenv("DISCORD"))) | ||
##tfm.run() | ||
#loop.run_forever() |