diff --git a/README.md b/README.md index 46234a9..6b77648 100644 --- a/README.md +++ b/README.md @@ -4,6 +4,15 @@   +# !ATTENTION! + +Usefully Links to write docs: + +ConnectionOptions: +- https://github.com/sidorares/node-mysql2/blob/master/typings/mysql/lib/Connection.d.ts#L82 + +# !ATTENTION! +
This NPM package was created to make it easier to stream audio to Discord.
There is a security feature of discord that stops the stream of audio after some time. This problem can be solved by disconnecting the Discord channel every 1.5 hours for 2 seconds and then reconnecting the channel. (If you use this package!) I recommend using a database to store the data e.g. MySQL, SQLite, json file and other database types.
The package does not fix this error yet. However, it is currently being worked on!
diff --git a/TESTING.ts b/TESTING.ts deleted file mode 100644 index 66a3179..0000000 --- a/TESTING.ts +++ /dev/null @@ -1,5 +0,0 @@ -import {AudioStreamManager} from "./src"; - -let temp = new AudioStreamManager("MySql", "frg"); - -console.log(temp); \ No newline at end of file diff --git a/package.json b/package.json index e50b925..c8fb569 100644 --- a/package.json +++ b/package.json @@ -18,6 +18,13 @@ "audio", "music" ], + "contributors": [ + { + "name": "Julian Lechner aka. FrauJulian", + "github": "https://github.com/FrauJulian", + "web": "https://fraujulian.xyz/" + } + ], "author": "FrauJulian | Julian Lechner", "license": "CUSTOM-LICENSE", "bugs": { diff --git a/src/DataAccess/Json/IJsonDao.ts b/src/DataAccess/Json/IJsonDao.ts new file mode 100644 index 0000000..c448ef5 --- /dev/null +++ b/src/DataAccess/Json/IJsonDao.ts @@ -0,0 +1,3 @@ +export interface IJsonDao { + +} \ No newline at end of file diff --git a/src/DataAccess/Json/JsonDao.ts b/src/DataAccess/Json/JsonDao.ts new file mode 100644 index 0000000..a81472b --- /dev/null +++ b/src/DataAccess/Json/JsonDao.ts @@ -0,0 +1,11 @@ +import {IJsonDao} from "./IJsonDao"; +import {Config, JsonDB} from "node-json-db"; + +export class JsonDao implements IJsonDao { + private _jsonDatabaseContext: JsonDB; + + constructor(fileLocation: string) { + this._jsonDatabaseContext = new JsonDB(new Config(fileLocation, true, false, "/", true)); + } + +} \ No newline at end of file diff --git a/src/DataAccess/MySql/IMySqlDao.ts b/src/DataAccess/MySql/IMySqlDao.ts new file mode 100644 index 0000000..5e740bc --- /dev/null +++ b/src/DataAccess/MySql/IMySqlDao.ts @@ -0,0 +1,3 @@ +export interface IMySqlDao { + +} \ No newline at end of file diff --git a/src/DataAccess/MySql/MysqlDao.ts b/src/DataAccess/MySql/MysqlDao.ts new file mode 100644 index 0000000..f659496 --- /dev/null +++ b/src/DataAccess/MySql/MysqlDao.ts @@ -0,0 +1,17 @@ +import {IMySqlDao} from "./IMySqlDao"; +import mysql, {Connection, ConnectionOptions} from 'mysql2/promise'; +import {Connection as BaseConnection} from "mysql2/typings/mysql/lib/Connection"; + +export class MysqlDao implements IMySqlDao { + private _mysqlDatabaseContext!: Connection; + + constructor(mysqlAuthenticationData: ConnectionOptions) { + this.InitializeDatabaseContext(mysqlAuthenticationData).catch(error => { + throw new Error(error) + }); + } + + private async InitializeDatabaseContext(mysqlAuthenticationData: ConnectionOptions): Promise