Skip to content
This repository was archived by the owner on Apr 24, 2024. It is now read-only.

Commit 27b4086

Browse files
committed
Add code
1 parent 7082894 commit 27b4086

32 files changed

+1866
-0
lines changed

Counting.code-workspace

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"folders": [
3+
{
4+
"path": "."
5+
}
6+
]
7+
}

docker-compose.yml

+45
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
version: "3"
2+
3+
volumes:
4+
CountingStatic:
5+
external: true
6+
CountingDB:
7+
external: true
8+
cache:
9+
external: true
10+
11+
12+
services:
13+
bot:
14+
restart: unless-stopped
15+
build: ./src
16+
depends_on:
17+
- postgres
18+
- cache
19+
volumes:
20+
- CountingStatic:/static
21+
container_name: Bot
22+
23+
postgres:
24+
restart: unless-stopped
25+
image: postgres:12-alpine
26+
environment:
27+
- POSTGRES_USER=countingbot
28+
- POSTGRES_PASSWORD=-YnZtyQ<|Te{0X^W
29+
- POSTGRES_DB=countingdb
30+
ports:
31+
- 5436:5432
32+
volumes:
33+
- ./schema.postgresql.sql:/docker-entrypoint-initdb.d/schema.postgresql.sql:ro
34+
- CountingDB:/var/lib/postgresql/data
35+
container_name: DB
36+
37+
cache:
38+
restart: unless-stopped
39+
image: redis:7.0.7-alpine
40+
ports:
41+
- '6379:6379'
42+
command: redis-server --loglevel warning
43+
volumes:
44+
- cache:/data
45+
container_name: Cache

schema.postgresql.sql

+265
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,265 @@
1+
/*
2+
* Copyright (c) 2023 numselli
3+
* All rights reserved.
4+
* This repository is licensed under the [Commons Clause License](https://commonsclause.com/). Monetized use of this repository is strictly disallowed.
5+
*/
6+
--
7+
-- PostgreSQL database dump
8+
--
9+
10+
-- Dumped from database version 12.13
11+
-- Dumped by pg_dump version 12.13
12+
13+
SET statement_timeout = 0;
14+
SET lock_timeout = 0;
15+
SET idle_in_transaction_session_timeout = 0;
16+
SET client_encoding = 'UTF8';
17+
SET standard_conforming_strings = on;
18+
SELECT pg_catalog.set_config('search_path', '', false);
19+
SET check_function_bodies = false;
20+
SET xmloption = content;
21+
SET client_min_messages = warning;
22+
SET row_security = off;
23+
24+
--
25+
-- Name: public; Type: SCHEMA; Schema: -; Owner: countingbot
26+
--
27+
28+
ALTER SCHEMA public OWNER TO countingbot;
29+
30+
--
31+
-- Name: SCHEMA public; Type: COMMENT; Schema: -; Owner: countingbot
32+
--
33+
34+
COMMENT ON SCHEMA public IS 'standard public schema';
35+
36+
37+
SET default_tablespace = '';
38+
39+
SET default_table_access_method = heap;
40+
41+
--
42+
-- Name: channellb; Type: TABLE; Schema: public; Owner: countingbot
43+
--
44+
45+
CREATE TABLE public.channellb (
46+
channelid character varying NOT NULL,
47+
userid character varying NOT NULL,
48+
correctcount numeric DEFAULT 0 NOT NULL,
49+
wrongcount numeric DEFAULT 0 NOT NULL,
50+
savesused numeric DEFAULT 0 NOT NULL,
51+
highestcount numeric DEFAULT 0 NOT NULL,
52+
guildid character varying
53+
);
54+
55+
56+
ALTER TABLE public.channellb OWNER TO countingbot;
57+
58+
--
59+
-- Name: channelsettings; Type: TABLE; Schema: public; Owner: countingbot
60+
--
61+
62+
CREATE TABLE public.channelsettings (
63+
channelid character varying NOT NULL,
64+
hs_enabled boolean DEFAULT true NOT NULL,
65+
wordsenabled boolean DEFAULT true NOT NULL,
66+
mathenabled boolean DEFAULT true NOT NULL,
67+
del_message boolean DEFAULT true NOT NULL,
68+
hook_enabled boolean DEFAULT false NOT NULL,
69+
hs_react character varying DEFAULT '🏆'::character varying NOT NULL,
70+
react character varying DEFAULT ''::character varying NOT NULL,
71+
saves_enabled boolean DEFAULT true NOT NULL,
72+
failban boolean DEFAULT false NOT NULL,
73+
enablewarning boolean DEFAULT true NOT NULL,
74+
egg_enabled boolean DEFAULT true NOT NULL,
75+
nofail boolean DEFAULT false NOT NULL,
76+
solo boolean DEFAULT false NOT NULL,
77+
wrongreact character varying DEFAULT ''::character varying NOT NULL
78+
);
79+
80+
81+
ALTER TABLE public.channelsettings OWNER TO countingbot;
82+
83+
--
84+
-- Name: countinglog; Type: TABLE; Schema: public; Owner: countingbot
85+
--
86+
87+
CREATE TABLE public.countinglog (
88+
channelid character varying,
89+
sender character varying,
90+
reason character varying,
91+
number numeric,
92+
date timestamp without time zone,
93+
jumpurl character varying
94+
);
95+
96+
97+
ALTER TABLE public.countinglog OWNER TO countingbot;
98+
99+
--
100+
-- Name: data; Type: TABLE; Schema: public; Owner: countingbot
101+
--
102+
103+
CREATE TABLE public.data (
104+
channelid character varying,
105+
guildid character varying,
106+
difficulty integer DEFAULT 0 NOT NULL,
107+
last_num numeric DEFAULT 0 NOT NULL,
108+
hs numeric DEFAULT 0 NOT NULL,
109+
previos_sender character varying DEFAULT ''::character varying NOT NULL,
110+
hs_user character varying DEFAULT ''::character varying NOT NULL,
111+
saves numeric DEFAULT 0 NOT NULL,
112+
max_saves integer DEFAULT 2 NOT NULL,
113+
savednumbers numeric DEFAULT 0 NOT NULL,
114+
goal numeric DEFAULT 0 NOT NULL,
115+
hook_id character varying,
116+
hook_token character varying,
117+
name character varying,
118+
hs_date timestamp without time zone,
119+
goal_date timestamp without time zone
120+
);
121+
122+
123+
ALTER TABLE public.data OWNER TO countingbot;
124+
125+
--
126+
-- Name: failrole; Type: TABLE; Schema: public; Owner: countingbot
127+
--
128+
129+
CREATE TABLE public.failrole (
130+
channelid character varying,
131+
roleid character varying,
132+
removeon timestamp without time zone DEFAULT (to_timestamp((0)::double precision))::timestamp without time zone NOT NULL
133+
);
134+
135+
136+
ALTER TABLE public.failrole OWNER TO countingbot;
137+
138+
--
139+
-- Name: failtexts; Type: TABLE; Schema: public; Owner: countingbot
140+
--
141+
142+
CREATE TABLE public.failtexts (
143+
channelid character varying NOT NULL,
144+
dubbleuser character varying DEFAULT 'You sent two or more numbers in a row, start at ++one++ again'::character varying NOT NULL,
145+
baknumber character varying DEFAULT 'You cant go back in numbers, silly 🤪, start at ++one++ again'::character varying NOT NULL,
146+
skippednum character varying DEFAULT 'You skipped a number 😠 start at ++one++ again'::character varying NOT NULL,
147+
dubblenumber character varying DEFAULT 'The same number was sent twice in a row, start at ++one++ again'::character varying NOT NULL
148+
);
149+
150+
151+
ALTER TABLE public.failtexts OWNER TO countingbot;
152+
153+
--
154+
-- Name: links; Type: TABLE; Schema: public; Owner: countingbot
155+
--
156+
157+
CREATE TABLE public.links (
158+
name character varying,
159+
value character varying
160+
);
161+
162+
163+
ALTER TABLE public.links OWNER TO countingbot;
164+
165+
--
166+
-- Name: mothlychannellb; Type: TABLE; Schema: public; Owner: countingbot
167+
--
168+
169+
CREATE TABLE public.mothlychannellb (
170+
channelid character varying NOT NULL,
171+
userid character varying NOT NULL,
172+
correctcount numeric DEFAULT 0 NOT NULL,
173+
wrongcount numeric DEFAULT 0 NOT NULL,
174+
savesused numeric DEFAULT 0 NOT NULL,
175+
highestcount numeric DEFAULT 0 NOT NULL,
176+
guildid character varying
177+
);
178+
179+
180+
ALTER TABLE public.mothlychannellb OWNER TO countingbot;
181+
182+
--
183+
-- Name: serverdata; Type: TABLE; Schema: public; Owner: countingbot
184+
--
185+
186+
CREATE TABLE public.serverdata (
187+
serverid character varying NOT NULL,
188+
name character varying,
189+
iconurl character varying
190+
);
191+
192+
193+
ALTER TABLE public.serverdata OWNER TO countingbot;
194+
195+
--
196+
-- Name: users; Type: TABLE; Schema: public; Owner: countingbot
197+
--
198+
199+
CREATE TABLE public.users (
200+
userid character varying NOT NULL,
201+
isbanned boolean DEFAULT false NOT NULL,
202+
is_public boolean DEFAULT true NOT NULL,
203+
saves numeric DEFAULT 0 NOT NULL,
204+
username character varying,
205+
max_saves numeric DEFAULT 4 NOT NULL
206+
);
207+
208+
209+
ALTER TABLE public.users OWNER TO countingbot;
210+
211+
--
212+
-- Name: channellb channellb_pkey; Type: CONSTRAINT; Schema: public; Owner: countingbot
213+
--
214+
215+
ALTER TABLE ONLY public.channellb
216+
ADD CONSTRAINT channellb_pkey PRIMARY KEY (userid, channelid);
217+
218+
219+
--
220+
-- Name: channelsettings channelsettings_pkey; Type: CONSTRAINT; Schema: public; Owner: countingbot
221+
--
222+
223+
ALTER TABLE ONLY public.channelsettings
224+
ADD CONSTRAINT channelsettings_pkey PRIMARY KEY (channelid);
225+
226+
--
227+
-- Name: failtexts failtexts_pkey; Type: CONSTRAINT; Schema: public; Owner: countingbot
228+
--
229+
230+
ALTER TABLE ONLY public.failtexts
231+
ADD CONSTRAINT failtexts_pkey PRIMARY KEY (channelid);
232+
233+
234+
--
235+
-- Name: mothlychannellb mothlychannellb_pkey; Type: CONSTRAINT; Schema: public; Owner: countingbot
236+
--
237+
238+
ALTER TABLE ONLY public.mothlychannellb
239+
ADD CONSTRAINT mothlychannellb_pkey PRIMARY KEY (channelid, userid);
240+
241+
242+
--
243+
-- Name: serverdata serverdata_pkey; Type: CONSTRAINT; Schema: public; Owner: countingbot
244+
--
245+
246+
ALTER TABLE ONLY public.serverdata
247+
ADD CONSTRAINT serverdata_pkey PRIMARY KEY (serverid);
248+
249+
--
250+
-- Name: users users_pkey; Type: CONSTRAINT; Schema: public; Owner: countingbot
251+
--
252+
253+
ALTER TABLE ONLY public.users
254+
ADD CONSTRAINT users_pkey PRIMARY KEY (userid);
255+
256+
--
257+
-- Name: IDX_session_expire; Type: INDEX; Schema: public; Owner: countingbot
258+
--
259+
260+
CREATE INDEX "IDX_session_expire" ON public.session USING btree (expire);
261+
262+
263+
--
264+
-- PostgreSQL database dump complete
265+
--

settings.example.mjs

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
/*
2+
* Copyright (c) 2023 numselli
3+
* All rights reserved.
4+
* This repository is licensed under the [Commons Clause License](https://commonsclause.com/). Monetized use of this repository is strictly disallowed.
5+
*/
6+
export const token = "Bot TOKEN_HERE"
7+
export const ownerID = '726515812361437285'

src/Dockerfile

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
FROM node:19.3.0-alpine3.16
2+
ENV NODE_ENV production
3+
4+
WORKDIR /app
5+
6+
COPY . /app
7+
8+
RUN apk update && \
9+
apk add --update git && \
10+
apk add --update openssh
11+
12+
RUN npm install --force
13+
14+
CMD ["node", "index.mjs"]

0 commit comments

Comments
 (0)