Skip to content

Commit 4d696fa

Browse files
committed
Allow the bot to work with Jira Cloud
1 parent b2bfd4f commit 4d696fa

File tree

5 files changed

+14
-7
lines changed

5 files changed

+14
-7
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ node_modules
44
.vscode/*
55
.history
66
**/.DS_Store
7+
.idea/
78

89
**/*.log
910
settings.json

config/local.template.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# 1. Copy this file
22
# 2. Rename the copy to `local.yml`
3-
# 3. Change the bot token, and your Jira personal access token if desired, and save the file
3+
# 3. Change the bot token, and your Jira email+personal access token if desired, and save the file
44
#
55
# You can add more configs if you want to.
66
#
@@ -11,4 +11,5 @@
1111
# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
1212

1313
token: <your bot token>
14+
jireUser: <your jira email>
1415
jiraPat: <your personal access token>

config/template.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,9 @@ logDirectory: <string | false>
1111
# Your bot token used to log in to Discord with the bot.
1212
token: <string>
1313

14-
# Your Jira personal access token.
14+
# Your Jira E-Mail and personal access token.
1515
# Optional; if not assigned a value, the bot will not attempt to log into Jira.
16+
jiraUser: <string>
1617
jiraPat: <string>
1718

1819
# A list of user IDs for owner only commands.

src/BotConfig.ts

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,7 @@ export default class BotConfig {
116116

117117
private static token: string;
118118
private static jiraPat?: string;
119+
private static jiraUser?: string;
119120

120121
public static owners: Snowflake[];
121122

@@ -149,6 +150,7 @@ export default class BotConfig {
149150
this.logDirectory = getOrDefault( 'logDirectory', false );
150151

151152
this.token = config.get( 'token' );
153+
this.jiraUser = getOrDefault( 'jiraUser', undefined );
152154
this.jiraPat = getOrDefault( 'jiraPat', undefined );
153155

154156
this.owners = getOrDefault( 'owners', [] );
@@ -194,10 +196,12 @@ export default class BotConfig {
194196
public static jiraLogin(): void {
195197
// TODO: integrate newErrorHandling from Jira.js
196198
MojiraBot.jira = new JiraClient( {
197-
host: 'https://bugs.mojang.com',
198-
telemetry: false,
199-
authentication: this.jiraPat === undefined ? undefined : {
200-
personalAccessToken: this.jiraPat,
199+
host: 'https://mojira.atlassian.net',
200+
authentication: this.jiraPat === undefined || this.jiraUser === undefined ? undefined : {
201+
basic: {
202+
email: this.jiraUser,
203+
apiToken: this.jiraPat,
204+
},
201205
},
202206
} );
203207
}

src/tasks/VersionFeedTask.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ interface JiraVersion {
1313
archived: boolean;
1414
released: boolean;
1515
releaseDate?: string;
16-
projectId: number;
16+
projectId: number | string;
1717
}
1818

1919
function versionConv( version: Version ): JiraVersion | undefined {

0 commit comments

Comments
 (0)