Skip to content

Commit

Permalink
tidy up standard-server example
Browse files Browse the repository at this point in the history
  • Loading branch information
valgaze committed Jun 19, 2024
1 parent e0ec532 commit 1cf17bd
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
3 changes: 2 additions & 1 deletion examples/standard-server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,14 @@
"author": "[email protected]",
"license": "ISC",
"devDependencies": {
"tsx": "^4.7.0",
"@types/express": "^4.17.21",
"@types/node": "^20.10.1",
"tsx": "^4.7.0",
"typescript": "^3.9.10"
},
"dependencies": {
"body-parser": "^1.19.0",
"cross-fetch": "^4.0.0",
"dotenv": "^16.0.3",
"express": "^4.17.1",
"speedybot": "^2.0.0"
Expand Down
4 changes: 2 additions & 2 deletions examples/standard-server/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import * as bodyParser from "body-parser";
import { config } from "dotenv";
import * as express from "express";
import express from "express";
import { resolve } from "path";
import Bot from "./../settings/bot";
import { validateWebhook } from "./validateWebhook";
import { announceReady } from "../util";
import { SpeedyBot } from "../../../src";
import { SpeedyBot } from "speedybot";

// Expects .env to get token on BOT_TOKEN
config({ path: resolve(__dirname, "..", ".env") });
Expand Down
8 changes: 5 additions & 3 deletions examples/standard-server/util/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { logoRoll } from "../../../src";
import { logoRoll } from "speedybot";

export const announceReady = (
port: number | string,
Expand All @@ -7,11 +7,13 @@ export const announceReady = (
) => {
const isColorSupported = process.stdout.isTTY;
console.log(logoRoll());
const msg = `Server active on port ${port}
You must expose this port & register for incoming webhooks. Listening...`;
if (isColorSupported) {
const ServerReady = `\x1b[1m\x1b[7m\x1b[32m 🌐 CONNECTED \x1b[0m\x1b[32m Server active on ${port}, listening...\x1b[0m`;
const ServerReady = `\x1b[1m\x1b[7m\x1b[32m 🌐 CONNECTED \x1b[0m\x1b[32m ${msg}\x1b[0m`;
process.stdout.write(ServerReady + "\n");
} else {
console.log("Websockets Registered. Listening...");
console.log(`🌐 CONNECTED ${msg}`);
}
console.log(`You can reach ${name} here: ${email}`);
};

0 comments on commit 1cf17bd

Please sign in to comment.