Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add config option for Discord setActivity #423

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,8 @@ First you need to create a Discord bot user, which you can do by following the i
"irc": ["irc_nick1", "irc_nick2"], // Ignore specified IRC nicks and do not send their messages to Discord.
"discord": ["discord_nick1", "discord_nick2"] // Ignore specified Discord nicks and do not send their messages to IRC.
},
// Sets the discord activity status, can be set to one of "PLAYING, STREAMING, LISTENING or WATCHING"
"discordStatus": ["PLAYING", "with you!"],
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe it would be more self explantory if this was an object? E.g. something like:

"discordStatus": {
  "name": ...,
  "type": ...,
  "url": ...
}

// List of webhooks per channel
"webhooks": {
"#discord": "https://discordapp.com/api/webhooks/id/token"
Expand Down
5 changes: 5 additions & 0 deletions lib/bot.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ class Bot {
this.ircStatusNotices = options.ircStatusNotices;
this.announceSelfJoin = options.announceSelfJoin;
this.webhookOptions = options.webhooks;
this.discordStatus = options.discordStatus;

// Nicks to ignore
this.ignoreUsers = options.ignoreUsers || {};
Expand Down Expand Up @@ -125,6 +126,10 @@ class Bot {
attachListeners() {
this.discord.on('ready', () => {
logger.info('Connected to Discord');
if (this.discordStatus) {
this.discord.user.setActivity(this.discordStatus[1], { type: this.discordStatus[0] });
logger.info('The activity for', this.discord.user.username, 'has been set to', this.discordStatus[0].toLowerCase(), this.discordStatus[1]);
}
});

this.ircClient.on('registered', (message) => {
Expand Down