Skip to content

Commit

Permalink
Merge pull request #708 from ArtBlocks/debugging-login
Browse files Browse the repository at this point in the history
debugging artbot login issues
  • Loading branch information
grantoesterling authored Jan 21, 2025
2 parents a125d14 + 70a1424 commit bb35b45
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 6 deletions.
4 changes: 4 additions & 0 deletions src/Classes/APIBots/ReservoirListBot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,10 @@ export class ReservoirListBot extends APIPollBot {
Math.abs(this.recentListings[tokenID] - price) <= IDENTICAL_TOLERANCE
) {
console.log(`Skipping identical relisting for ${tokenID}`)
console.log(
'recentListings size:',
Object.keys(this.recentListings).length
)
return
}
this.recentListings[tokenID] = price
Expand Down
35 changes: 29 additions & 6 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -157,8 +157,8 @@ app.post('/new-mint', function (req: any, res: any) {
})
})

app.listen(PORT, function () {
console.log('Server is listening on port ', PORT)
app.listen(PORT, '0.0.0.0', function () {
console.log('Server is listening on port', PORT)
})

app.get('/callback', (req: any, res: any) => {
Expand All @@ -174,15 +174,38 @@ export const discordClient = new Client({
GatewayIntentBits.MessageContent,
],
})

console.log('Discord client created')
console.log('PRODUCTION_MODE:', PRODUCTION_MODE)
console.log('DISCORD_TOKEN exists:', !!DISCORD_TOKEN)

if (PRODUCTION_MODE) {
discordClient.login(DISCORD_TOKEN)
console.log('Attempting Discord login...')
discordClient
.login(DISCORD_TOKEN)
.then(() => {
console.log('Discord login attempt successful')
})
.catch((error) => {
console.error('Discord login failed:', error)
})
}
export const triviaBot = new TriviaBot(discordClient)
new ScheduleBot(discordClient.channels.cache, projectConfig)

discordClient.on('ready', () => {
console.info(`Logged in as ${discordClient.user?.tag}!`)
console.log(`Logged in as ${discordClient.user?.tag}!`)
})

discordClient.on('error', (error) => {
console.error('Discord client error:', error)
})

discordClient.on('disconnect', () => {
console.log('Discord client disconnected')
})

export const triviaBot = new TriviaBot(discordClient)
new ScheduleBot(discordClient.channels.cache, projectConfig)

discordClient.on(Events.MessageCreate, async (msg) => {
const msgAuthor = msg.author.username
const msgContent = msg.content
Expand Down

0 comments on commit bb35b45

Please sign in to comment.