Comments (28)
You mean my config.json? I'm pretty new to hosting Discord bots so I appreciate your help.
Do I need to do anything with what I have now or just copy the repo in a different file and try running the bot again after configuring?
Correct. The config.json
file is not included in the original repo, so you can copy the examples from config-sample.json
.
Try copying the repo into a different folder, do npm install && npm build && npm start
from discord-stonker-bot.
TextBasedChannels
is the correct import. It's part of the discord.js
documentation.
from discord-stonker-bot.
Actually, after I re-installed the node modules, I can re-produce the same error. Working on it atm!
from discord-stonker-bot.
I've published v2.0.1
! Going to close this issue for now. If the same problem persists, let me know and I'll re-open it.
from discord-stonker-bot.
Could this have anything to do with my inputs on my config.json?
from discord-stonker-bot.
Can I see the copy of your package.json
?
from discord-stonker-bot.
I didn't make any changes, but here is what I have:
{
"name": "discord-stocker-bot",
"displayName": "Discord Stonker Bot",
"version": "2.0.0",
"description": "A Discord bot built for finance-related servers",
"main": "build/src/index.js",
"private": true,
"scripts": {
"start": "ts-node src/index.ts",
"build": "npm-run-all -p build:*",
"build:tsc": "tsc --build",
"build:copyfiles": "copyfiles -u 1 src/**/*.ejs build/src/"
},
"repository": {
"type": "git",
"url": "git://github.com/mrjackyliang/discord-stonker-bot.git"
},
"funding": {
"type": "github",
"url": "https://github.com/sponsors/mrjackyliang"
},
"keywords": [
"discord",
"discord-bot",
"stocks",
"moderation",
"scheduler",
"auto-reply"
],
"author": "Jacky Liang",
"license": "ISC",
"bugs": {
"url": "https://github.com/mrjackyliang/discord-stonker-bot/issues"
},
"files": [],
"homepage": "https://github.com/mrjackyliang/discord-stonker-bot#readme",
"engines": {
"node": "16"
},
"dependencies": {
"axios": "^0.21.1",
"chalk": "^4.1.0",
"discord.js": "^13.1.0",
"ejs": "^3.1.6",
"express": "^4.17.1",
"lodash": "^4.17.21",
"luxon": "^2.0.2",
"node-schedule": "^2.0.0",
"rss-parser": "^3.12.0"
},
"devDependencies": {
"@types/express": "^4.17.13",
"@types/lodash": "^4.14.172",
"@types/luxon": "^2.0.2",
"@types/node": "^17.0.8",
"@types/node-schedule": "^1.3.2",
"@types/xml2js": "^0.4.9",
"@typescript-eslint/eslint-plugin": "^4.29.1",
"@typescript-eslint/parser": "^4.29.1",
"copyfiles": "^2.4.1",
"eslint": "^7.32.0",
"eslint-config-airbnb-base": "^14.2.1",
"eslint-plugin-import": "^2.24.0",
"npm-run-all": "^4.1.5",
"ts-node": "^10.4.0",
"tslib": "^2.3.1",
"typescript": "^4.3.5"
}
}
from discord-stonker-bot.
"@types/node": "^17.0.8",
"ts-node": "^10.2.0",
"tslib": "^2.3.1",
these are extra packages not included in the original release
from discord-stonker-bot.
So those need to be removed?
from discord-stonker-bot.
If you've installed extra packages, yes. They have not been tested with the latest release.
from discord-stonker-bot.
I removed them from my package.json but still getting the error. Does it matter if I'm running this on a Raspberry Pi?
/home/pi/Documents/discord-stonker-bot/node_modules/ts-node/src/index.ts:750
return new TSError(diagnosticText, diagnosticCodes);
^
TSError: ⨯ Unable to compile TypeScript:
src/modules/anti-raid.ts:1:43 - error TS2724: '"discord.js"' has no exported member named 'TextBasedChannels'. Did you mean 'TextBasedChannel'?
1 import { GuildMember, PartialGuildMember, TextBasedChannels } from 'discord.js';
~~~~~~~~~~~~~~~~~
src/modules/anti-raid.ts:172:15 - error TS7006: Parameter 'error' implicitly has an 'any' type.
172 }).catch((error) => generateLogMessage(
~~~~~
at createTSError (/home/pi/Documents/discord-stonker-bot/node_modules/ts-node/src/index.ts:750:12)
at reportTSError (/home/pi/Documents/discord-stonker-bot/node_modules/ts-node/src/index.ts:754:19)
at getOutput (/home/pi/Documents/discord-stonker-bot/node_modules/ts-node/src/index.ts:941:36)
at Object.compile (/home/pi/Documents/discord-stonker-bot/node_modules/ts-node/src/index.ts:1243:30)
at Module.m._compile (/home/pi/Documents/discord-stonker-bot/node_modules/ts-node/src/index.ts:1370:30)
at Module._extensions..js (node:internal/modules/cjs/loader:1153:10)
at Object.require.extensions.<computed> [as .ts] (/home/pi/Documents/discord-stonker-bot/node_modules/ts-node/src/index.ts:1374:12)
at Module.load (node:internal/modules/cjs/loader:981:32)
at Function.Module._load (node:internal/modules/cjs/loader:822:12)
at Module.require (node:internal/modules/cjs/loader:1005:19) {
diagnosticText: `\x1B[96msrc/modules/anti-raid.ts\x1B[0m:\x1B[93m1\x1B[0m:\x1B[93m43\x1B[0m - \x1B[91merror\x1B[0m\x1B[90m TS2724: \x1B[0m'"discord.js"' has no exported member named 'TextBasedChannels'. Did you mean 'TextBasedChannel'?\n` +
'\n' +
"\x1B[7m1\x1B[0m import { GuildMember, PartialGuildMember, TextBasedChannels } from 'discord.js';\n" +
'\x1B[7m \x1B[0m \x1B[91m ~~~~~~~~~~~~~~~~~\x1B[0m\n' +
"\x1B[96msrc/modules/anti-raid.ts\x1B[0m:\x1B[93m172\x1B[0m:\x1B[93m15\x1B[0m - \x1B[91merror\x1B[0m\x1B[90m TS7006: \x1B[0mParameter 'error' implicitly has an 'any' type.\n" +
'\n' +
'\x1B[7m172\x1B[0m }).catch((error) => generateLogMessage(\n' +
'\x1B[7m \x1B[0m \x1B[91m ~~~~~\x1B[0m\n',
diagnosticCodes: [ 2724, 7006 ]
}
from discord-stonker-bot.
Try reinstalling the bot and re-add your configuration in there
from discord-stonker-bot.
And tell me the commands you used to compile the bot
from discord-stonker-bot.
You mean my config.json? I'm pretty new to hosting Discord bots so I appreciate your help.
Do I need to do anything with what I have now or just copy the repo in a different file and try running the bot again after configuring?
from discord-stonker-bot.
config.json (without my bot token)
{
"settings": {
"client-token": "MY_TOKEN",
"guild-id": "722409280497516566",
"bot-prefix": "!",
"server-http-port": 8080,
"server-https-port": 8443,
"server-https-key": "",
"server-https-cert": "",
"server-https-ca": "",
"time-zone": "Etc/UTC",
"log-level": 30
},
"snitch": {
"change-nickname": {
"channel-id": "927961532644601887"
},
"change-username": {
"channel-id": "927961532644601887"
},
"delete-message": {
"channel-id": ""
},
"includes-link": {
"channel-id": ""
},
"update-message": {
"channel-id": ""
},
"upload-attachment": {
"channel-id": ""
}
},
"commands": {
"bulk-ban": [
{
"description": "Sample role",
"id": "000000000000000000"
}
],
"fetch-duplicates": [
{
"description": "Sample role",
"id": "000000000000000000"
}
],
"fetch-members": [
{
"description": "Sample role",
"id": "000000000000000000"
}
],
"help-menu": [
{
"description": "Sample role",
"id": "000000000000000000"
}
],
"role-manager": [
{
"description": "Sample role",
"id": "000000000000000000"
}
],
"toggle-perms": [
{
"description": "Sample role",
"id": "000000000000000000"
}
],
"voice-tools": [
{
"description": "Sample role",
"id": "000000000000000000"
}
]
},
"api-fetch": {
"etherscan-gas-oracle": {
"feed": {
"channel-id": ""
},
"command": {
"regex": {
"pattern": "(?:)",
"flags": "g"
},
"allowed-roles": [
{
"description": "Sample role",
"id": "000000000000000000"
}
]
}
},
"stocktwits-trending": {
"feed": {
"channel-id": ""
},
"command": {
"regex": {
"pattern": "(?:)",
"flags": "g"
},
"allowed-roles": [
{
"description": "Sample role",
"id": "000000000000000000"
}
]
}
}
},
"anti-raid": {
"auto-ban": {
"avatar": [
"37cb8a08bcba4e2a909a4404550c81f2", "53d8b20879c56b05819a5159904bb1da"
],
"username": [
"Bad User"
]
},
"membership-gate": {
"role-id": "000000000000000000",
"channel-id": "000000000000000000",
"message": "Welcome to %GUILD_NAME%! Thank you for verifying, %MEMBER_MENTION%."
},
"monitor": {
"guild-join": {
"channel-id": "000000000000000000"
},
"guild-leave": {
"channel-id": "000000000000000000"
}
}
},
"schedule-posts": [
{
"name": "Sample",
"channel-id": "000000000000000000",
"payload": {
"content": "This is a sample scheduled post"
},
"reactions": [
"🟢",
"🟡",
"🔴"
],
"send-every": {
"time-zone": "Etc/UTC",
"days-of-week": [
0,
1,
2,
3,
4,
5,
6
],
"year": [
2020
],
"month": [
0
],
"date": [
1
],
"hour": [
0
],
"minute": [
0
],
"second": [
0
]
},
"skip-days": [
"2021-01-01",
"2021-02-01"
]
}
],
"rss-feeds": [
{
"name": "Sample",
"channel-id": "000000000000000000",
"interval": "* * * * *",
"url": "https://www.example.com/feed",
"message": "Sample: %ITEM_TITLE% - %ITEM_LINK%"
}
],
"regex-rules": [
{
"name": "Sample Regex",
"channel-id": "000000000000000000",
"regex": {
"pattern": "(?:)",
"flags": "g"
},
"direct-message": "This type of text is not allowed in this channel!",
"exclude-roles": [
{
"description": "Sample role",
"id": "000000000000000000"
}
]
}
],
"suspicious-words": {
"channel-id": "000000000000000000",
"categories": [
{
"category": "Sample",
"words": [
"suspicious",
"really suspicious"
]
}
]
},
"roles": [
{
"name": "Remove B role if member is A",
"type": "yes-to-yes",
"before": [
{
"description": "A role",
"id": "000000000000000000"
}
],
"after": [
{
"description": "A role",
"id": "000000000000000000"
}
],
"to-remove": [
{
"description": "B role",
"id": "000000000000000000"
}
]
},
{
"name": "Remove B role if member is not A",
"type": "no-to-no",
"before": [
{
"description": "A role",
"id": "000000000000000000"
}
],
"after": [
{
"description": "A role",
"id": "000000000000000000"
}
],
"to-remove": [
{
"description": "B role",
"id": "000000000000000000"
}
]
},
{
"name": "Add B role if member went from A to not A",
"type": "yes-to-no",
"before": [
{
"description": "A role",
"id": "000000000000000000"
}
],
"after": [
{
"description": "A role",
"id": "000000000000000000"
}
],
"to-add": [
{
"description": "B role",
"id": "000000000000000000"
}
]
},
{
"name": "Remove B role if member went from not A to A",
"type": "no-to-yes",
"before": [
{
"description": "A role",
"id": "000000000000000000"
}
],
"after": [
{
"description": "A role",
"id": "000000000000000000"
}
],
"to-remove": [
{
"description": "B role",
"id": "000000000000000000"
}
]
}
],
"auto-reply": [
{
"name": "Sample",
"channel-ids": [
"000000000000000000"
],
"reply": true,
"regex": {
"pattern": "(?:)",
"flags": "gi"
},
"messages": [
"reply 1",
"reply 2"
]
}
],
"message-copier": [
{
"name": "Sample",
"channel-id": "000000000000000000",
"regex": {
"pattern": "(?:)",
"flags": "g"
},
"replacements": [
{
"pattern": "",
"flags": "",
"replace-with": ""
}
],
"format": "Author Mention: %AUTHOR_MENTION%\nAuthor Tag: %AUTHOR_TAG%\nChannel Mention: %CHANNEL_MENTION%\nMessage Content: %MESSAGE_CONTENT%\nMessage Excerpt: %MESSAGE_EXCERPT%\nMessage URL: %MESSAGE_URL%",
"include-attachments": true,
"delete-message": false,
"allowed-users": [
"000000000000000000"
],
"allowed-channels": [
"000000000000000000"
],
"disallowed-users": [
"000000000000000000"
],
"disallowed-channels": [
"000000000000000000"
]
}
],
"affiliate-links": {
"links": [
{
"website": "Affiliate Company",
"regex": {
"pattern": "(?:)",
"flags": "gi"
}
}
],
"channel-id": "000000000000000000",
"direct-message": "Please do not send affiliate links!",
"excluded-roles": [
{
"description": "Sample role",
"id": "000000000000000000"
}
]
},
"invite-generator": {
"path": "/invite",
"options": {
"max-age": 120,
"max-uses": 1
},
"design": {
"logo-url": "",
"favicon-url": "",
"background-color": "",
"link-color": "",
"text-color": ""
},
"inject-code": {
"header": "",
"submit-success": "",
"submit-fail": ""
},
"recaptcha": {
"site-key": "",
"secret-key": ""
}
},
"toggle-perms": [
{
"name": "Sample",
"id": "sample",
"on": [
{
"description": "#sample-channel",
"channel-id": "000000000000000000",
"channel-perms": [
{
"description": "Sample role",
"user-or-role-id": "000000000000000000",
"user-or-role-perms": {
"SEND_MESSAGES": false
}
}
]
}
],
"off": [
{
"description": "#sample-channel",
"channel-id": "000000000000000000",
"channel-perms": [
{
"description": "Sample role",
"user-or-role-id": "000000000000000000",
"user-or-role-perms": {
"SEND_MESSAGES": false
}
}
]
}
]
}
],
"bump-threads": [
{
"name": "#sample-channel",
"channel-id": "000000000000000000",
"thread-id": "000000000000000000"
}
]
}
from discord-stonker-bot.
Had to to npm run build
instead because npm build
was not recognized and got this error:
> [email protected] build
> npm-run-all -p build:*
> [email protected] build:tsc
> tsc --build
> [email protected] build:copyfiles
> copyfiles -u 1 src/**/*.ejs build/src/
src/modules/anti-raid.ts:1:43 - error TS2724: '"discord.js"' has no exported member named 'TextBasedChannels'. Did you mean 'TextBasedChannel'?
1 import { GuildMember, PartialGuildMember, TextBasedChannels } from 'discord.js';
~~~~~~~~~~~~~~~~~
src/modules/anti-raid.ts:172:15 - error TS7006: Parameter 'error' implicitly has an 'any' type.
172 }).catch((error) => generateLogMessage(
~~~~~
src/modules/commands.ts:6:3 - error TS2724: '"discord.js"' has no exported member named 'TextBasedChannels'. Did you mean 'TextBasedChannel'?
6 TextBasedChannels,
~~~~~~~~~~~~~~~~~
src/modules/commands.ts:59:13 - error TS7006: Parameter 'error' implicitly has an 'any' type.
59 }).catch((error) => generateLogMessage(
~~~~~
src/modules/commands.ts:90:13 - error TS7006: Parameter 'error' implicitly has an 'any' type.
90 }).catch((error) => generateLogMessage(
~~~~~
src/modules/commands.ts:122:13 - error TS7006: Parameter 'error' implicitly has an 'any' type.
122 }).catch((error) => generateLogMessage(
~~~~~
src/modules/content.ts:1:10 - error TS2724: '"discord.js"' has no exported member named 'TextBasedChannels'. Did you mean 'TextBasedChannel'?
1 import { TextBasedChannels } from 'discord.js';
~~~~~~~~~~~~~~~~~
src/modules/content.ts:196:23 - error TS7006: Parameter 'error' implicitly has an 'any' type.
196 }).catch((error) => generateLogMessage(
~~~~~
src/modules/content.ts:314:43 - error TS7006: Parameter 'post' implicitly has an 'any' type.
314 sendToChannel.send(payload).then((post) => {
~~~~
src/modules/content.ts:331:23 - error TS7006: Parameter 'error' implicitly has an 'any' type.
331 )).catch((error) => generateLogMessage(
~~~~~
src/modules/content.ts:340:19 - error TS7006: Parameter 'error' implicitly has an 'any' type.
340 }).catch((error) => generateLogMessage(
~~~~~
Found 11 errors.
from discord-stonker-bot.
Can I see a copy of your TypeScript configuration as well?
from discord-stonker-bot.
tsconfig.json
{
"compilerOptions": {
"allowJs": true,
"allowSyntheticDefaultImports": true,
"esModuleInterop": true,
"forceConsistentCasingInFileNames": true,
"module": "CommonJS",
"moduleResolution": "Node",
"noFallthroughCasesInSwitch": true,
"noImplicitAny": true,
"noImplicitReturns": true,
"noUnusedLocals": true,
"outDir": "./build",
"removeComments": true,
"resolveJsonModule": true,
"sourceMap": true,
"strict": true,
"target": "ES2020"
},
"include": [
"./src"
]
}
from discord-stonker-bot.
Hmm I am stumped. Can you try running this on your computer instead? I have this bot running on Google Cloud and on my computer, never seen this issue before.
from discord-stonker-bot.
Yeah I'll test it out and report back
from discord-stonker-bot.
I tried running on my Mac and still getting the same errors.
TSError: ⨯ Unable to compile TypeScript:
src/modules/anti-raid.ts:1:43 - error TS2724: '"discord.js"' has no exported member named 'TextBasedChannels'. Did you mean 'TextBasedChannel'?
1 import { GuildMember, PartialGuildMember, TextBasedChannels } from 'discord.js';
~~~~~~~~~~~~~~~~~
src/modules/anti-raid.ts:172:15 - error TS7006: Parameter 'error' implicitly has an 'any' type.
172 }).catch((error) => generateLogMessage(
from discord-stonker-bot.
Does it have to do with TextBasedChannels
since that is always the same issue?
from discord-stonker-bot.
Can you try these commands and output it here:
npm list -g --depth=0
node -v
from discord-stonker-bot.
Mac:
npm list:
/usr/local/lib
├── [email protected]
└── [email protected]
Node Version:
v16.13.0
from discord-stonker-bot.
Now this is interesting. I updated all the packages, and type references and it all works. Looks like I'm going to push a bugfix version up by tonight! Sorry for the wait!
from discord-stonker-bot.
Awesome!! No worries, just glad you got it figured out. I'll check it out later to see if I can get it working once the fix is pushed.
from discord-stonker-bot.
Yeah, I just haven't updated the packages in a while probably that was why it caused all the weird errors. But I fixed it, and adding some enhancements, then I'll deploy a new one
from discord-stonker-bot.
This issue is now locked and considered resolved. If you have questions or inquiries, you may start a new issue.
from discord-stonker-bot.
Related Issues (4)
- Turn off/on features HOT 4
- Sweep for banned avatars after join HOT 12
- Duplicate Avatar feature HOT 18
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from discord-stonker-bot.