From 837621a2e26a652e08889e50f2b79e4712011978 Mon Sep 17 00:00:00 2001
From: Mia <49593536+maxalexandderpi@users.noreply.github.com>
Date: Mon, 29 Jun 2020 00:45:57 -0500
Subject: [PATCH 1/7] add github plugin
---
config/formats.ts | 27 +++++
data/abilities.ts | 8 ++
data/formats-data.ts | 190 +++++++++++++++++++++++++++++++++
data/moves.ts | 8 ++
data/random-teams.ts | 39 +++++++
lib/repl.ts | 15 +++
package.json | 2 +
server/chat-commands/info.ts | 6 +-
server/chat-plugins/github.ts | 181 +++++++++++++++++++++++++++++++
server/chat-plugins/youtube.ts | 53 +++++++++
server/rooms.ts | 92 ++++++++++++++++
11 files changed, 620 insertions(+), 1 deletion(-)
create mode 100644 server/chat-plugins/github.ts
diff --git a/config/formats.ts b/config/formats.ts
index 49220cde96b3a..c0507800b934d 100644
--- a/config/formats.ts
+++ b/config/formats.ts
@@ -161,10 +161,37 @@ export const Formats: FormatList = [
mod: 'gen8',
ruleset: ['Same Type Clause', 'Standard', 'Dynamax Clause'],
banlist: [
+<<<<<<< HEAD
'Blaziken', 'Calyrex-Ice', 'Calyrex-Shadow', 'Dialga', 'Eternatus', 'Genesect', 'Giratina', 'Groudon', 'Ho-Oh', 'Kyogre', 'Kyurem-White',
'Lugia', 'Lunala', 'Magearna', 'Marshadow', 'Mewtwo', 'Naganadel', 'Necrozma-Dawn-Wings', 'Necrozma-Dusk-Mane', 'Palkia', 'Pheromosa',
'Rayquaza', 'Reshiram', 'Solgaleo', 'Xerneas', 'Yveltal', 'Zacian', 'Zamazenta', 'Zekrom', 'Zygarde-Base',
'Moody', 'Power Construct', 'Shadow Tag', 'Terrain Extender', 'Baton Pass',
+=======
+<<<<<<< HEAD
+ 'Eternatus', 'Kyurem-Black', 'Kyurem-White', 'Lunala', 'Magearna', 'Marshadow', 'Melmetal', 'Mewtwo', 'Necrozma-Dawn-Wings',
+ 'Necrozma-Dusk-Mane', 'Reshiram', 'Solgaleo', 'Urshifu-Rapid-Strike', 'Zacian', 'Zamazenta', 'Zekrom',
+=======
+ 'Eternatus', 'Kyurem-Black', 'Kyurem-White', 'Lunala', 'Magearna', 'Marshadow', 'Melmetal', 'Mewtwo',
+ 'Necrozma-Dawn-Wings', 'Necrozma-Dusk-Mane', 'Reshiram', 'Solgaleo', 'Zacian', 'Zamazenta', 'Zekrom',
+>>>>>>> add github plugin
+ 'Damp Rock', 'Smooth Rock', 'Moody', 'Shadow Tag', 'Baton Pass',
+ ],
+ },
+ {
+ name: "[Gen 8] Anything Goes",
+ threads: [
+ `• Anything Goes`,
+ ],
+
+ mod: 'gen8',
+ searchShow: false,
+ ruleset: ['Obtainable', 'Team Preview', 'HP Percentage Mod', 'Cancel Mod', 'Endless Battle Clause'],
+ },
+ {
+ name: "[Gen 8] ZU",
+ threads: [
+ `• ZU Metagame Discussion`,
+>>>>>>> add github plugin
],
},
{
diff --git a/data/abilities.ts b/data/abilities.ts
index b3f0f0f9eb032..697e33d30bdf4 100644
--- a/data/abilities.ts
+++ b/data/abilities.ts
@@ -2816,7 +2816,15 @@ export const Abilities: {[abilityid: string]: AbilityData} = {
}
},
name: "Quick Draw",
+<<<<<<< HEAD
rating: 2.5,
+=======
+<<<<<<< HEAD
+ rating: 3,
+=======
+ rating: 2,
+>>>>>>> add github plugin
+>>>>>>> add github plugin
num: 259,
},
quickfeet: {
diff --git a/data/formats-data.ts b/data/formats-data.ts
index bfd13a42b51fe..9281ea5257a02 100644
--- a/data/formats-data.ts
+++ b/data/formats-data.ts
@@ -280,12 +280,22 @@ export const FormatsData: {[k: string]: SpeciesFormatsData} = {
doublesTier: "(DUU)",
},
sandslashalola: {
+<<<<<<< HEAD
randomBattleMoves: ["earthquake", "ironhead", "knockoff", "rapidspin", "swordsdance", "tripleaxel"],
+=======
+ randomBattleMoves: ["earthquake", "ironhead", "knockoff", "rapidspin", "stealthrock", "swordsdance", "tripleaxel"],
+<<<<<<< HEAD
+>>>>>>> add github plugin
randomBattleLevel: 86,
randomDoubleBattleMoves: ["drillrun", "ironhead", "protect", "swordsdance", "tripleaxel"],
randomDoubleBattleLevel: 84,
tier: "NU",
doublesTier: "DUU",
+=======
+ randomBattleLevel: 88,
+ tier: "OU",
+ doublesTier: "DOU",
+>>>>>>> add github plugin
},
nidoranf: {
tier: "LC",
@@ -541,12 +551,26 @@ export const FormatsData: {[k: string]: SpeciesFormatsData} = {
doublesTier: "NFE",
},
alakazam: {
+<<<<<<< HEAD
randomBattleMoves: ["counter", "focusblast", "nastyplot", "psychic", "shadowball"],
randomBattleLevel: 82,
randomDoubleBattleMoves: ["focusblast", "nastyplot", "protect", "psychic", "shadowball"],
randomDoubleBattleLevel: 80,
tier: "UU",
doublesTier: "(DUU)",
+=======
+<<<<<<< HEAD
+ randomBattleMoves: ["counter", "focusblast", "nastyplot", "psychic", "psyshock", "shadowball"],
+ randomBattleLevel: 80,
+ randomDoubleBattleMoves: ["focusblast", "nastyplot", "protect", "psychic", "shadowball"],
+ randomDoubleBattleLevel: 80,
+=======
+ randomBattleMoves: ["focusblast", "nastyplot", "psychic", "psyshock", "shadowball"],
+ randomBattleLevel: 80,
+>>>>>>> add github plugin
+ tier: "OU",
+ doublesTier: "DOU",
+>>>>>>> add github plugin
},
alakazammega: {
isNonstandard: "Past",
@@ -896,11 +920,21 @@ export const FormatsData: {[k: string]: SpeciesFormatsData} = {
doublesTier: "(DUU)",
},
hitmontop: {
+<<<<<<< HEAD
randomBattleMoves: ["closecombat", "earthquake", "rapidspin", "suckerpunch", "toxic", "tripleaxel"],
+=======
+ randomBattleMoves: ["closecombat", "machpunch", "rapidspin", "suckerpunch", "toxic", "tripleaxel"],
+<<<<<<< HEAD
+>>>>>>> add github plugin
randomBattleLevel: 86,
randomDoubleBattleMoves: ["closecombat", "coaching", "fakeout", "helpinghand", "rapidspin", "suckerpunch", "tripleaxel"],
randomDoubleBattleLevel: 88,
tier: "NU",
+=======
+ randomBattleLevel: 88,
+ randomDoubleBattleMoves: ["closecombat", "fakeout", "feint", "helpinghand", "rapidspin", "suckerpunch", "wideguard"],
+ tier: "PU",
+>>>>>>> add github plugin
doublesTier: "(DUU)",
},
lickitung: {
@@ -953,9 +987,19 @@ export const FormatsData: {[k: string]: SpeciesFormatsData} = {
},
chansey: {
randomBattleMoves: ["healbell", "seismictoss", "softboiled", "stealthrock", "toxic"],
+<<<<<<< HEAD
randomBattleLevel: 82,
tier: "UU",
doublesTier: "(DUU)",
+=======
+ randomBattleLevel: 80,
+<<<<<<< HEAD
+ tier: "OU",
+=======
+ tier: "UUBL",
+>>>>>>> add github plugin
+ doublesTier: "NFE",
+>>>>>>> add github plugin
},
blissey: {
randomBattleMoves: ["healbell", "protect", "seismictoss", "toxic", "wish"],
@@ -1053,11 +1097,20 @@ export const FormatsData: {[k: string]: SpeciesFormatsData} = {
},
scyther: {
randomBattleMoves: ["brickbreak", "dualwingbeat", "knockoff", "roost", "swordsdance", "uturn"],
+<<<<<<< HEAD
randomBattleLevel: 82,
randomDoubleBattleMoves: ["brickbreak", "bugbite", "dualwingbeat", "uturn"],
randomDoubleBattleLevel: 84,
tier: "UU",
+<<<<<<< HEAD
doublesTier: "LC Uber",
+=======
+ doublesTier: "DUU",
+=======
+ randomBattleLevel: 86,
+ tier: "PUBL",
+>>>>>>> add github plugin
+>>>>>>> add github plugin
},
scizor: {
randomBattleMoves: ["bulletpunch", "dualwingbeat", "knockoff", "roost", "superpower", "swordsdance", "uturn"],
@@ -1678,12 +1731,24 @@ export const FormatsData: {[k: string]: SpeciesFormatsData} = {
doublesTier: "(DUU)",
},
heracross: {
+<<<<<<< HEAD
randomBattleMoves: ["closecombat", "facade", "knockoff", "megahorn", "spikes", "stoneedge"],
randomBattleLevel: 84,
randomDoubleBattleMoves: ["closecombat", "facade", "knockoff", "megahorn", "protect", "swordsdance"],
randomDoubleBattleLevel: 84,
+<<<<<<< HEAD
tier: "RUBL",
doublesTier: "(DUU)",
+=======
+ tier: "UU",
+ doublesTier: "DUU",
+=======
+ randomBattleMoves: ["closecombat", "facade", "knockoff", "megahorn", "stoneedge", "substitute"],
+ randomBattleLevel: 84,
+ tier: "OU",
+ doublesTier: "DOU",
+>>>>>>> add github plugin
+>>>>>>> add github plugin
},
heracrossmega: {
isNonstandard: "Past",
@@ -2120,9 +2185,14 @@ export const FormatsData: {[k: string]: SpeciesFormatsData} = {
},
shedinja: {
randomBattleMoves: ["poltergeist", "shadowsneak", "swordsdance", "willowisp", "xscissor"],
+<<<<<<< HEAD
randomBattleLevel: 88,
randomDoubleBattleMoves: ["allyswitch", "poltergeist", "protect", "shadowsneak", "swordsdance", "willowisp", "xscissor"],
randomDoubleBattleLevel: 88,
+=======
+ randomBattleLevel: 100,
+ randomDoubleBattleMoves: ["allyswitch", "protect", "shadowsneak", "swordsdance", "willowisp", "xscissor"],
+>>>>>>> add github plugin
tier: "(PU)",
doublesTier: "(DUU)",
},
@@ -2276,12 +2346,26 @@ export const FormatsData: {[k: string]: SpeciesFormatsData} = {
tier: "LC",
},
sharpedo: {
+<<<<<<< HEAD
randomBattleMoves: ["closecombat", "crunch", "destinybond", "hydropump", "protect"],
+=======
+ randomBattleMoves: ["closecombat", "crunch", "destinybond", "flipturn", "protect", "waterfall"],
+<<<<<<< HEAD
+>>>>>>> add github plugin
randomBattleLevel: 82,
randomDoubleBattleMoves: ["closecombat", "crunch", "flipturn", "icebeam", "protect", "waterfall"],
randomDoubleBattleLevel: 84,
tier: "UU",
+<<<<<<< HEAD
doublesTier: "(DUU)",
+=======
+ doublesTier: "DUU",
+=======
+ randomBattleLevel: 84,
+ tier: "OU",
+ doublesTier: "DOU",
+>>>>>>> add github plugin
+>>>>>>> add github plugin
},
sharpedomega: {
isNonstandard: "Past",
@@ -3974,10 +4058,22 @@ export const FormatsData: {[k: string]: SpeciesFormatsData} = {
},
golurk: {
randomBattleMoves: ["dynamicpunch", "earthquake", "poltergeist", "rockpolish", "stoneedge"],
+<<<<<<< HEAD
randomBattleLevel: 84,
randomDoubleBattleMoves: ["dynamicpunch", "earthquake", "highhorsepower", "icepunch", "poltergeist", "protect"],
randomDoubleBattleLevel: 86,
tier: "RU",
+=======
+ randomBattleLevel: 86,
+<<<<<<< HEAD
+ randomDoubleBattleMoves: ["dynamicpunch", "earthquake", "highhorsepower", "icepunch", "poltergeist", "protect"],
+ randomDoubleBattleLevel: 86,
+ tier: "NU",
+=======
+ randomDoubleBattleMoves: ["closecombat", "earthquake", "highhorsepower", "icepunch", "protect", "shadowpunch"],
+ tier: "PUBL",
+>>>>>>> add github plugin
+>>>>>>> add github plugin
doublesTier: "(DUU)",
},
pawniard: {
@@ -4437,11 +4533,25 @@ export const FormatsData: {[k: string]: SpeciesFormatsData} = {
},
dragalge: {
randomBattleMoves: ["dracometeor", "dragonpulse", "flipturn", "focusblast", "sludgewave", "toxicspikes"],
+<<<<<<< HEAD
randomBattleLevel: 84,
randomDoubleBattleMoves: ["dracometeor", "dragonpulse", "focusblast", "protect", "sludgebomb"],
randomDoubleBattleLevel: 86,
tier: "RU",
doublesTier: "(DUU)",
+=======
+<<<<<<< HEAD
+ randomBattleLevel: 82,
+ randomDoubleBattleMoves: ["dracometeor", "dragonpulse", "focusblast", "protect", "sludgebomb"],
+ randomDoubleBattleLevel: 86,
+ tier: "UU",
+ doublesTier: "DUU",
+=======
+ randomBattleLevel: 84,
+ tier: "OU",
+ doublesTier: "DOU",
+>>>>>>> add github plugin
+>>>>>>> add github plugin
},
clauncher: {
tier: "LC",
@@ -4540,8 +4650,15 @@ export const FormatsData: {[k: string]: SpeciesFormatsData} = {
randomBattleMoves: ["earthquake", "hornleech", "poltergeist", "rockslide", "trickroom", "woodhammer"],
randomBattleLevel: 86,
randomDoubleBattleMoves: ["allyswitch", "poltergeist", "rockslide", "trickroom", "willowisp", "woodhammer"],
+<<<<<<< HEAD
randomDoubleBattleLevel: 88,
+<<<<<<< HEAD
tier: "NU",
+=======
+=======
+>>>>>>> add github plugin
+ tier: "PU",
+>>>>>>> add github plugin
doublesTier: "(DUU)",
},
pumpkaboo: {
@@ -4582,10 +4699,23 @@ export const FormatsData: {[k: string]: SpeciesFormatsData} = {
},
gourgeistsuper: {
randomBattleMoves: ["poltergeist", "powerwhip", "rockslide", "shadowsneak", "trickroom"],
+<<<<<<< HEAD
randomBattleLevel: 88,
randomDoubleBattleMoves: ["poltergeist", "powerwhip", "protect", "shadowsneak", "trickroom"],
randomDoubleBattleLevel: 88,
tier: "PU",
+=======
+<<<<<<< HEAD
+ randomBattleLevel: 86,
+ randomDoubleBattleMoves: ["poltergeist", "powerwhip", "protect", "shadowsneak", "trickroom"],
+ randomDoubleBattleLevel: 88,
+ tier: "NU",
+=======
+ randomBattleLevel: 88,
+ randomDoubleBattleMoves: ["powerwhip", "protect", "shadowsneak", "synthesis", "trickroom"],
+ tier: "PU",
+>>>>>>> add github plugin
+>>>>>>> add github plugin
doublesTier: "(DUU)",
},
bergmite: {
@@ -5456,12 +5586,23 @@ export const FormatsData: {[k: string]: SpeciesFormatsData} = {
doublesTier: "DUU",
},
rillaboom: {
+<<<<<<< HEAD
randomBattleMoves: ["grassyglide", "highhorsepower", "knockoff", "uturn", "woodhammer"],
+=======
+ randomBattleMoves: ["acrobatics", "grassyglide", "highhorsepower", "knockoff", "swordsdance", "uturn", "woodhammer"],
+<<<<<<< HEAD
+>>>>>>> add github plugin
randomBattleLevel: 80,
randomDoubleBattleMoves: ["fakeout", "grassyglide", "highhorsepower", "protect", "uturn", "woodhammer"],
randomDoubleBattleLevel: 80,
tier: "OU",
doublesTier: "DOU",
+=======
+ randomBattleLevel: 84,
+ randomDoubleBattleMoves: ["drumbeating", "fakeout", "highhorsepower", "protect", "superpower", "uturn", "woodhammer"],
+ tier: "RU",
+ doublesTier: "DUU",
+>>>>>>> add github plugin
},
rillaboomgmax: {
randomBattleMoves: ["acrobatics", "grassyglide", "highhorsepower", "knockoff", "swordsdance"],
@@ -5892,10 +6033,20 @@ export const FormatsData: {[k: string]: SpeciesFormatsData} = {
},
indeedeef: {
randomBattleMoves: ["calmmind", "expandingforce", "healingwish", "hypervoice", "mysticalfire"],
+<<<<<<< HEAD
randomBattleLevel: 84,
randomDoubleBattleMoves: ["expandingforce", "followme", "healpulse", "helpinghand", "protect"],
randomDoubleBattleLevel: 80,
+<<<<<<< HEAD
tier: "RU",
+=======
+ tier: "RUBL",
+=======
+ randomBattleLevel: 86,
+ randomDoubleBattleMoves: ["allyswitch", "followme", "healpulse", "helpinghand", "protect", "psychic"],
+ tier: "NU",
+>>>>>>> add github plugin
+>>>>>>> add github plugin
doublesTier: "DOU",
},
morpeko: {
@@ -6033,40 +6184,79 @@ export const FormatsData: {[k: string]: SpeciesFormatsData} = {
urshifu: {
randomBattleMoves: ["closecombat", "ironhead", "suckerpunch", "uturn", "wickedblow"],
randomBattleLevel: 80,
+<<<<<<< HEAD
randomDoubleBattleMoves: ["closecombat", "ironhead", "protect", "suckerpunch", "wickedblow"],
+<<<<<<< HEAD
randomDoubleBattleLevel: 76,
+=======
+ randomDoubleBattleLevel: 80,
+=======
+>>>>>>> add github plugin
+>>>>>>> add github plugin
tier: "OU",
doublesTier: "DUber",
},
urshifurapidstrike: {
+<<<<<<< HEAD
randomBattleMoves: ["bulkup", "drainpunch", "substitute", "surgingstrikes"],
randomBattleLevel: 80,
randomDoubleBattleMoves: ["aquajet", "closecombat", "poisonjab", "protect", "surgingstrikes", "uturn"],
randomDoubleBattleLevel: 80,
+=======
+ randomBattleMoves: ["closecombat", "surgingstrikes", "thunderpunch", "uturn"],
+ randomBattleLevel: 82,
+>>>>>>> add github plugin
tier: "OU",
doublesTier: "DOU",
},
urshifugmax: {
randomBattleMoves: ["bulkup", "drainpunch", "substitute", "wickedblow"],
+<<<<<<< HEAD
randomBattleLevel: 80,
+<<<<<<< HEAD
isNonstandard: "Gigantamax",
+=======
+=======
+>>>>>>> add github plugin
+>>>>>>> add github plugin
tier: "(Uber)",
doublesTier: "(DUber)",
},
urshifurapidstrikegmax: {
+<<<<<<< HEAD
randomBattleMoves: ["bulkup", "closecombat", "surgingstrikes", "thunderpunch", "uturn"],
randomBattleLevel: 80,
isNonstandard: "Gigantamax",
+=======
+<<<<<<< HEAD
+ randomBattleMoves: ["closecombat", "surgingstrikes", "thunderpunch", "uturn"],
+ randomBattleLevel: 80,
+=======
+ randomBattleMoves: ["bulkup", "drainpunch", "substitute", "surgingstrikes"],
+ randomBattleLevel: 82,
+>>>>>>> add github plugin
+>>>>>>> add github plugin
tier: "(Uber)",
doublesTier: "(DUber)",
},
zarude: {
randomBattleMoves: ["bulkup", "closecombat", "darkestlariat", "powerwhip", "uturn"],
+<<<<<<< HEAD
randomBattleLevel: 82,
randomDoubleBattleMoves: ["closecombat", "darkestlariat", "junglehealing", "powerwhip", "protect", "rockslide"],
randomDoubleBattleLevel: 80,
tier: "UU",
doublesTier: "DUU",
+=======
+ randomBattleLevel: 80,
+<<<<<<< HEAD
+ randomDoubleBattleMoves: ["closecombat", "darkestlariat", "junglehealing", "powerwhip", "protect", "rockslide"],
+ randomDoubleBattleLevel: 80,
+=======
+>>>>>>> add github plugin
+ isNonstandard: "Unobtainable",
+ tier: "Unreleased",
+>>>>>>> add github plugin
},
zarudedada: {
isNonstandard: "Unobtainable",
diff --git a/data/moves.ts b/data/moves.ts
index 76ab70e618124..dc11890652312 100644
--- a/data/moves.ts
+++ b/data/moves.ts
@@ -12706,7 +12706,11 @@ export const Moves: {[moveid: string]: MoveData} = {
priority: 0,
flags: {protect: 1, mirror: 1},
onTry(pokemon, target) {
+<<<<<<< HEAD
if (!target.item) {
+=======
+ if (!target.item || target.ignoringItem()) {
+>>>>>>> add github plugin
this.attrLastMove('[still]');
this.add('-fail', pokemon);
return null;
@@ -14062,7 +14066,11 @@ export const Moves: {[moveid: string]: MoveData} = {
priority: 0,
flags: {protect: 1, mirror: 1},
onBasePower(basePower, pokemon, target) {
+<<<<<<< HEAD
if (this.field.isTerrain('electricterrain') && target.isGrounded()) {
+=======
+ if (this.field.isTerrain('electricterrain') && !target.runImmunity('Ground')) {
+>>>>>>> add github plugin
this.debug('terrain buff');
return this.chainModify(2);
}
diff --git a/data/random-teams.ts b/data/random-teams.ts
index 5ec2764362054..fa3648a517cd0 100644
--- a/data/random-teams.ts
+++ b/data/random-teams.ts
@@ -653,12 +653,15 @@ export class RandomTeams {
case 'destinybond': case 'healbell':
if (movePool.includes('protect') || movePool.includes('wish')) rejected = true;
break;
+<<<<<<< HEAD
case 'fireblast':
if (hasAbility['Serene Grace'] && (!hasMove['trick'] || counter.Status > 1)) rejected = true;
break;
case 'firepunch':
if (movePool.includes('bellydrum') || hasMove['earthquake'] && movePool.includes('substitute')) rejected = true;
break;
+=======
+>>>>>>> add github plugin
case 'flamecharge': case 'sacredsword':
if (counter.damagingMoves.length < 3 && !counter.setupType) rejected = true;
if (!hasType['Grass'] && movePool.includes('swordsdance')) rejected = true;
@@ -740,6 +743,9 @@ export class RandomTeams {
case 'fakeout':
if (counter.setupType || hasMove['protect'] || hasMove['rapidspin'] || hasMove['substitute'] || hasMove['uturn']) rejected = true;
break;
+ case 'flipturn':
+ if (counter.Status >= 1) rejected = true;
+ break;
case 'healingwish': case 'memento':
if (counter.setupType || !!counter['recovery'] || hasMove['substitute'] || hasMove['uturn']) rejected = true;
break;
@@ -932,9 +938,25 @@ export class RandomTeams {
case 'shadowclaw':
if (hasType['Steel'] && hasMove['shadowsneak'] && counter.Physical < 4) rejected = true;
break;
+<<<<<<< HEAD
case 'dragonpulse': case 'spacialrend':
if (hasMove['dracometeor'] && counter.Special < 4) rejected = true;
break;
+<<<<<<< HEAD
+=======
+ case 'outrage':
+ if (counter.setupType && (hasMove['scaleshot'] || movePool.includes('scaleshot'))) rejected = true;
+ break;
+=======
+ case 'shadowsneak':
+ if (!hasType['Ghost'] && !!counter['recovery']) rejected = true;
+ if (hasMove['substitute'] || hasMove['toxic'] || hasMove['trickroom']) rejected = true;
+ break;
+ case 'dragonpulse': case 'outrage':
+ if (hasMove['dracometeor'] && counter.Special < 4) rejected = true;
+ break;
+>>>>>>> add github plugin
+>>>>>>> add github plugin
case 'darkpulse':
if ((hasMove['foulplay'] || hasMove['knockoff'] || hasMove['suckerpunch'] || hasMove['defog']) && counter.setupType !== 'Special') rejected = true;
if (!hasType['Dark'] && !!counter.Status) rejected = true;
@@ -1343,7 +1365,15 @@ export class RandomTeams {
item = (scarfReqs && this.randomChance(2, 3)) ? 'Choice Scarf' : 'Choice Specs';
} else if (((counter.Physical >= 3 && hasMove['defog']) || (counter.Special >= 3 && hasMove['healingwish'])) && !counter['priority'] && !hasMove['uturn'] && !isDoubles) {
item = 'Choice Scarf';
+<<<<<<< HEAD
} else if (hasMove['raindance'] || hasMove['sunnyday'] || (ability === 'Speed Boost' && !counter['hazards']) || ability === 'Stance Change' && counter.damagingMoves.length >= 3) {
+=======
+<<<<<<< HEAD
+ } else if (hasMove['raindance'] || hasMove['sunnyday'] || (ability === 'Speed Boost' && hasMove['destinybond']) || ability === 'Stance Change' && counter.Physical + counter.Special > 2) {
+=======
+ } else if (hasMove['raindance'] || hasMove['sunnyday'] || ability === 'Stance Change' && counter.Physical + counter.Special > 2) {
+>>>>>>> add github plugin
+>>>>>>> add github plugin
item = 'Life Orb';
} else if (this.dex.getEffectiveness('Rock', species) >= 1 && (['Defeatist', 'Emergency Exit', 'Multiscale'].includes(ability) || hasMove['courtchange'] || hasMove['defog'] || hasMove['rapidspin']) && !isDoubles) {
item = 'Heavy-Duty Boots';
@@ -1513,8 +1543,17 @@ export class RandomTeams {
case 'Darmanitan':
if (species.gen === 8 && this.randomChance(1, 2)) continue;
break;
+<<<<<<< HEAD
case 'Magearna': case 'Toxtricity': case 'Zacian': case 'Zamazenta':
+<<<<<<< HEAD
case 'Appletun': case 'Blastoise': case 'Butterfree': case 'Copperajah': case 'Grimmsnarl': case 'Inteleon': case 'Rillaboom': case 'Snorlax': case 'Urshifu':
+=======
+ case 'Appletun': case 'Blastoise': case 'Butterfree': case 'Copperajah': case 'Grimmsnarl': case 'Snorlax': case 'Urshifu':
+=======
+ case 'Appletun': case 'Butterfree': case 'Copperajah': case 'Grimmsnarl': case 'Snorlax':
+ case 'Toxtricity': case 'Urshifu': case 'Zacian': case 'Zamazenta':
+>>>>>>> add github plugin
+>>>>>>> add github plugin
if (this.gen >= 8 && this.randomChance(1, 2)) continue;
break;
}
diff --git a/lib/repl.ts b/lib/repl.ts
index 9d930c7c94c04..f2aeef7cab4a4 100644
--- a/lib/repl.ts
+++ b/lib/repl.ts
@@ -97,12 +97,16 @@ export const Repl = new class ReplSingleton {
});
server.once('error', (err: NodeJS.ErrnoException) => {
+<<<<<<< HEAD
server.close();
+=======
+>>>>>>> add github plugin
if (err.code === "EADDRINUSE") {
fs.unlink(pathname, _err => {
if (_err && _err.code !== "ENOENT") {
crashlogger(_err, `REPL: ${filename}`);
}
+<<<<<<< HEAD
});
} else if (err.code === "EACCES") {
if (process.platform !== 'win32') {
@@ -110,11 +114,22 @@ export const Repl = new class ReplSingleton {
}
} else {
crashlogger(err, `REPL: ${filename}`);
+=======
+ server.close();
+ });
+ } else {
+ crashlogger(err, `REPL: ${filename}`);
+ server.close();
+>>>>>>> add github plugin
}
});
server.once('close', () => {
Repl.socketPathnames.delete(pathname);
+<<<<<<< HEAD
+=======
+ Repl.start(filename, evalFunction);
+>>>>>>> add github plugin
});
} catch (err) {
console.error(`Could not start REPL server "${filename}": ${err}`);
diff --git a/package.json b/package.json
index fd50a53c21dd5..883d929b60bf8 100644
--- a/package.json
+++ b/package.json
@@ -12,6 +12,8 @@
},
"optionalDependencies": {
"cloud-env": "^0.2.3",
+ "githubhook": "^1.9.3",
+ "node-oom-heapdump": "^1.2.0",
"node-static": "^0.7.11",
"nodemailer": "^6.4.6",
"permessage-deflate": "^0.1.7",
diff --git a/server/chat-commands/info.ts b/server/chat-commands/info.ts
index a35b4115b8f67..716a9e7020b62 100644
--- a/server/chat-commands/info.ts
+++ b/server/chat-commands/info.ts
@@ -1617,13 +1617,17 @@ export const commands: ChatCommands = {
);
},
+<<<<<<< HEAD
suggestions(target, room, user) {
+=======
+ '!suggestion': true,
+ suggestion(target, room, user) {
+>>>>>>> add github plugin
if (!this.runBroadcast()) return;
this.sendReplyBox(`Make a suggestion for Pokémon Showdown`);
},
bugreport: 'bugs',
- bugreports: 'bugs',
bugs(target, room, user) {
if (!this.runBroadcast()) return;
if (room?.battle) {
diff --git a/server/chat-plugins/github.ts b/server/chat-plugins/github.ts
new file mode 100644
index 0000000000000..d5651d11cd686
--- /dev/null
+++ b/server/chat-plugins/github.ts
@@ -0,0 +1,181 @@
+/**
+ * Plugin to notify given rooms / the Development room on Pokemon Showdown
+ * of github updates.
+ * Some html / design from xfix's github bot, plugin by mia-pi.
+ */
+// @ts-ignore old enough module it has no types
+import * as githubhook from 'githubhook';
+import {Utils} from '../../lib/utils';
+
+const cooldown = 15 * 60 * 1000;
+const rooms: RoomID[] = Config.github?.rooms ? Config.github.rooms : ['staff', 'upperstaff', 'development'];
+
+export const github = githubhook({
+ port: (Config.github?.port || Config.port + 1),
+ secret: (Config.github?.secret || ''),
+});
+
+github.on(
+ 'push',
+ (repo: string, ref: string, result: AnyObject) => {
+ return GithubParser.push(repo, ref, result)
+ }
+);
+
+github.on(
+ 'pull_request',
+ (repo: string, ref: string, result: AnyObject) => {
+ return GithubParser.pull(repo, ref, result)
+ }
+);
+export const GithubParser = new class {
+ gitbans: Map;
+ pushes: AnyObject;
+ constructor() {
+ this.pushes = {};
+ this.gitbans = new Map();
+ this.gitbans.set('dependabot-preview[bot]', 'always');
+ }
+ shouldShow(id: string, repo: string) {
+ id = toID(id);
+ if (!this.pushes[id]) return true;
+ if (this.gitbans.has(id)) return false;
+ if (!this.pushes[repo]) this.pushes[repo] = {};
+ if (Date.now() - this.pushes[repo][id] < cooldown) return true;
+ if (Date.now() - this.pushes[repo][id] > cooldown) this.pushes[repo][id] = Date.now();
+ return false;
+ }
+ repository(repo: string) {
+ if (repo.includes('client')) return `client`;
+ if (repo === 'pokemon-showdown') return `server`;
+ if (repo.includes(`dex`)) return `dex`;
+ return repo;
+ }
+ report(html: string) {
+ Rooms.global.notifyRooms(rooms, `|c|~|/uhtml github,${html}
`);
+ }
+ push(repo: string, ref: string, result: AnyObject) {
+ const url = result.compare;
+ let buf = result.commits.map((commit: AnyObject) => {
+ const message = commit.message;
+ const shortMessage = /.+/.exec(message)![0];
+ const id = commit.id.slice(0, 6);
+ const formattedRepo = `[${this.repository(repo)}]`;
+ const userName = Utils.html`(${this.getName(commit.author.name)})`;
+ return `${formattedRepo} ${id} ${shortMessage} ${userName}`
+ }).join('
');
+ if (!this.pushes[repo]) this.pushes[repo] = {};
+ this.pushes[repo][result.pusher.name] = Date.now();
+ this.report(buf);
+ }
+ pull(repo: string, ref: string, result: AnyObject) {
+ let committer = toID(result.sender.login);
+ if (this.gitbans.has(committer)) return;
+ const num = result.pull_request.number;
+ const url = result.pull_request.html_url;
+ const title = result.pull_request.title;
+ const name = this.getName(result.sender.login);
+ let action = result.action;
+ if (action === 'synchronize') {
+ action = 'updated';
+ }
+ if (action === 'review_requested') {
+ action = 'requested a review for'
+ }
+ // filter code from github bot
+ // Marking a PR as ready for review after drafting isn't really important
+ if (action === 'ready_for_review') {
+ return;
+ }
+ // Nobody cares about labels
+ if (action === 'labeled' || action === 'unlabeled') {
+ return;
+ }
+ // not really important to see converting open to draft
+ if (action === 'converted_to_draft') {
+ return;
+ }
+ this.report(
+ `[${repo}] ${name} ` +
+ `${action} PR#${num}: ${title}`
+ );
+ }
+ getName(name: string) {
+ const devRoom = Rooms.get('development');
+ if (!devRoom) return name;
+ // @ts-ignore
+ if (!devRoom.settings.usernames) devRoom.settings.usernames = {};
+ // @ts-ignore
+ if (devRoom.settings.usernames[name]) {
+ // @ts-ignore
+ return devRoom.settings.usernames[name];
+ }
+ return name;
+ }
+}
+
+export const commands: ChatCommands = {
+ git: 'github',
+ github: {
+ ban(target, room, user) {
+ if (room.roomid !== 'development') return this.errorReply(`This command can only be used in the Development room.`);
+ target = toID(target);
+ if (!this.can('mute', null, room)) return false;
+ if (GithubParser.gitbans.has(target)) return this.errorReply(`${target} is already gitbanned.`);
+ GithubParser.gitbans.set(target, Date.now());
+ this.privateModAction(`(${user.name} prevented ${target} from being reported by the plugin.)`);
+ return this.modlog('GITBAN', null, target);
+ },
+ unban(target, room, user) {
+ if (room.roomid !== 'development') return this.errorReply(`This command can only be used in the Development room.`);
+ target = toID(target);
+ if (!this.can('mute', null, room)) return false;
+ if (!GithubParser.gitbans.has(target)) return this.errorReply(`${target} is not gitbanned.`);
+ GithubParser.gitbans.delete(target);
+ this.privateModAction(`(${user.name} allowed ${target} to be reported by the plugin.)`);
+ return this.modlog('UNGITBAN', null, target);
+ },
+ bans(target, room, user) {
+ if (room.roomid !== 'development') return this.errorReply(`This command can only be used in the Development room.`);
+ if (!this.can('mute', null, room)) return false;
+ let buf = `IDs banned from being reported by the Github Plugin:
`;
+ for (const [id, time] of GithubParser.gitbans) {
+ buf += `- ${id}: ${typeof time === 'number' ? Chat.toTimestamp(new Date(time)) : time}
`;
+ }
+ return this.sendReplyBox(buf);
+ },
+ setname(target, room, user) {
+ if (room.roomid !== 'development') return this.errorReply(`This command can only be used in the Development room.`);
+ if (!this.can('declare', null, room)) return false;
+ const [oldID, newName] = target.split(',');
+ if (!target || !oldID || !newName) return this.errorReply(`Specify a GitHub username and new name.`);
+ // @ts-ignore
+ if (!room.settings.usernames) room.settings.usernames = {};
+ // @ts-ignore
+ if (room.settings.usernames[oldID] && room.settings.usernames[oldID] === newName) {
+ return this.errorReply(`${oldID}'s GitHub plugin name is already ${newName}.`);
+ }
+ // @ts-ignore
+ room.settings.usernames[oldID] = newName;
+ room.saveSettings();
+ this.sendReply(`Set ${oldID}'s name to be ${newName} in the Github Plugin.`);
+ this.modlog(`GIT NAME`, null, `"${oldID}" to "${newName}"`);
+ },
+ resetname(target, room, user) {
+ if (room.roomid !== 'development') return this.errorReply(`This command can only be used in the Development room.`);
+ if (!this.can('declare', null, room)) return false;
+ if (!target) return this.errorReply(`Specify a name.`);
+ // @ts-ignore
+ if (!(target in room.settings.usernames)) {
+ return this.errorReply(`${target} does not have a name set for the Github Plugin.`);
+ }
+ // @ts-ignore
+ delete room.settings.usernames[target];
+ room.saveSettings();
+ this.sendReply(`Reset ${target}'s name in the Github Plugin.`);
+ return this.modlog(`GIT RESETNAME`, null, `${target}`);
+ },
+ },
+};
+
+github.listen();
diff --git a/server/chat-plugins/youtube.ts b/server/chat-plugins/youtube.ts
index 4addaf4014172..da7f1464d3fbd 100644
--- a/server/chat-plugins/youtube.ts
+++ b/server/chat-plugins/youtube.ts
@@ -293,9 +293,16 @@ export function destroy() {
export const commands: ChatCommands = {
async randchannel(target, room, user) {
+<<<<<<< HEAD
room = this.requireRoom('youtube' as RoomID);
if (Object.keys(YouTube.data.channels).length < 1) return this.errorReply(`No channels in the database.`);
target = toID(target);
+=======
+ if (!room) return this.requiresRoom();
+ if (room.roomid !== 'youtube') return this.errorReply(`This command can only be used in the YouTube room.`);
+ if (!Config.youtubeKey) return this.errorReply(`Youtube is not configured.`);
+ if (Object.keys(channelData).length < 1) return this.errorReply(`No channels in the database.`);
+>>>>>>> add github plugin
this.runBroadcast();
const data = await YouTube.randChannel(target);
return this.sendReplyBox(data);
@@ -305,10 +312,17 @@ export const commands: ChatCommands = {
yt: 'youtube',
youtube: {
async addchannel(target, room, user) {
+<<<<<<< HEAD
room = this.requireRoom('youtube' as RoomID);
this.checkCan('mute', null, room);
let [id, name] = target.split(',');
if (name) name = name.trim();
+=======
+ if (!room) return this.requiresRoom();
+ if (room.roomid !== 'youtube') return this.errorReply(`This command can only be used in the YouTube room.`);
+ if (!Config.youtubeKey) return this.errorReply(`Youtube is not configured.`);
+ const [id, name] = target.split(',');
+>>>>>>> add github plugin
if (!id) return this.errorReply('Specify a channel ID.');
await YouTube.getChannelData(id, name);
this.modlog('ADDCHANNEL', null, `${id} ${name ? `username: ${name}` : ''}`);
@@ -331,7 +345,13 @@ export const commands: ChatCommands = {
removechannelhelp: [`/youtube removechannel - Delete channel data from the YouTube database. Requires: % @ #`],
async channel(target, room, user) {
+<<<<<<< HEAD
room = this.requireRoom('youtube' as RoomID);
+=======
+ if (!room) return this.requiresRoom();
+ if (room.roomid !== 'youtube') return this.errorReply(`This command can only be used in the YouTube room.`);
+ if (!Config.youtubeKey) return this.errorReply(`Youtube is not configured.`);
+>>>>>>> add github plugin
const channel = YouTube.channelSearch(target);
if (!channel) return this.errorReply(`No channels with ID or name ${target} found.`);
const data = await YouTube.generateChannelDisplay(channel);
@@ -341,13 +361,37 @@ export const commands: ChatCommands = {
channelhelp: [
'/youtube channel - View the data of a specified channel. Can be either channel ID or channel name.',
],
+<<<<<<< HEAD
video() {
return this.errorReply(`Use /show instead.`);
+=======
+ async video(target, room, user) {
+ if (!room) return this.requiresRoom();
+ if (room.roomid !== 'youtube') return this.errorReply(`This command can only be used in the YouTube room.`);
+ if (!Config.youtubeKey) return this.errorReply(`Youtube is not configured.`);
+ if (!target) return this.errorReply(`Provide a valid youtube link.`);
+ const html = await YouTube.generateVideoDisplay(target);
+ if (!html) return this.errorReply(`This url is invalid. Please use a youtu.be link or a youtube.com link.`);
+ this.runBroadcast();
+ if (this.broadcasting) {
+ this.addBox(html);
+ return room.update();
+ } else {
+ return this.sendReplyBox(html);
+ }
+>>>>>>> add github plugin
},
channels(target, room, user) {
+<<<<<<< HEAD
target = toID(target);
return this.parse(`/j view-channels${target ? `-${target}` : ''}`);
+=======
+ let all;
+ if (toID(target) === 'all') all = true;
+ if (!Config.youtubeKey) return this.errorReply(`Youtube is not configured.`);
+ return this.parse(`/j view-channels${all ? '-all' : ''}`);
+>>>>>>> add github plugin
},
help(target, room, user) {
return this.parse('/help youtube');
@@ -369,6 +413,7 @@ export const commands: ChatCommands = {
YouTube.save();
},
interval: 'repeat',
+<<<<<<< HEAD
repeat(target, room, user) {
room = this.requireRoom('youtube' as RoomID);
this.checkCan('declare', null, room);
@@ -376,6 +421,14 @@ export const commands: ChatCommands = {
if (!YouTube.interval) return this.errorReply(`The YouTube plugin is not currently running an interval.`);
return this.sendReply(`Interval is currently set to ${Chat.toDurationString(YouTube.intervalTime * 60 * 1000)}.`);
}
+=======
+ async repeat(target, room, user) {
+ if (!room) return this.requiresRoom();
+ if (room.roomid !== 'youtube') return this.errorReply(`This command can only be used in the YouTube room.`);
+ if (!Config.youtubeKey) return this.errorReply(`Youtube is not configured.`);
+ if (!this.can('declare', null, room)) return false;
+ if (!target) return this.sendReply(`Interval is currently set to ${Chat.toDurationString(YouTube.intervalTime)}.`);
+>>>>>>> add github plugin
if (Object.keys(channelData).length < 1) return this.errorReply(`No channels in the database.`);
if (isNaN(parseInt(target))) return this.errorReply(`Specify a number (in minutes) for the interval.`);
YouTube.runInterval(target);
diff --git a/server/rooms.ts b/server/rooms.ts
index 9040533778fb0..22ff80fbf08d4 100644
--- a/server/rooms.ts
+++ b/server/rooms.ts
@@ -568,12 +568,77 @@ export abstract class BasicRoom {
return successUserid;
}
+<<<<<<< HEAD
logUserStats() {
let total = 0;
let guests = 0;
const groups: {[k: string]: number} = {};
for (const group of Config.groupsranking) {
groups[group] = 0;
+=======
+ onUpdateIdentity(user: User) {}
+ destroy() {}
+}
+
+export class GlobalRoom extends BasicRoom {
+ readonly type: 'global';
+ readonly active: false;
+ readonly settingsList: RoomSettings[];
+ readonly chatRooms: ChatRoom[];
+ /**
+ * Rooms that users autojoin upon connecting
+ */
+ readonly autojoinList: RoomID[];
+ /**
+ * Rooms that staff autojoin upon connecting
+ */
+ readonly staffAutojoinList: RoomID[];
+ readonly ladderIpLog: WriteStream;
+ readonly users: UserTable;
+ readonly reportUserStatsInterval: NodeJS.Timeout;
+ readonly modlogStream: WriteStream;
+ lockdown: boolean | 'pre' | 'ddos';
+ battleCount: number;
+ lastReportedCrash: number;
+ lastBattle: number;
+ lastWrittenBattle: number;
+ userCount: number;
+ maxUsers: number;
+ maxUsersDate: number;
+ formatList: string;
+
+ readonly game: null;
+ readonly battle: null;
+ readonly tour: null;
+
+ constructor(roomid: RoomID) {
+ if (roomid !== 'global') throw new Error(`The global room's room ID must be 'global'`);
+ super(roomid);
+
+ this.type = 'global';
+ this.active = false;
+ this.settingsList = [];
+ try {
+ this.settingsList = require('../config/chatrooms.json');
+ if (!Array.isArray(this.settingsList)) this.settingsList = [];
+ } catch (e) {} // file doesn't exist [yet]
+
+ if (!this.settingsList.length) {
+ this.settingsList = [{
+ title: 'Lobby',
+ auth: {},
+ creationTime: Date.now(),
+ isOfficial: true,
+ autojoin: true,
+ }, {
+ title: 'Staff',
+ auth: {},
+ creationTime: Date.now(),
+ isPrivate: true,
+ staffRoom: true,
+ staffAutojoin: true,
+ }];
+>>>>>>> add github plugin
}
for (const i in this.users) {
const user = this.users[i];
@@ -804,11 +869,38 @@ export abstract class BasicRoom {
this.reportJoin('j', user.getIdentityWithStatus(this.roomid), user);
}
+<<<<<<< HEAD
const staffIntro = this.getStaffIntroMessage(user);
if (staffIntro) this.sendUser(user, staffIntro);
+=======
+<<<<<<< HEAD
+>>>>>>> add github plugin
this.users[user.id] = user;
this.userCount++;
+=======
+ const settings = {
+ title,
+ auth: {},
+ creationTime: Date.now(),
+ };
+ const room = Rooms.createChatRoom(id, title, settings);
+ if (id === 'lobby') Rooms.lobby = room;
+ this.settingsList.push(settings);
+ this.chatRooms.push(room);
+ this.writeChatRoomData();
+ return true;
+ }
+
+ prepBattleRoom(format: string) {
+ // console.log('BATTLE START BETWEEN: ' + p1.id + ' ' + p2.id);
+ const roomPrefix = `battle-${toID(Dex.getFormat(format).name)}-`;
+ let battleNum = this.lastBattle;
+ let roomid: RoomID;
+ do {
+ roomid = `${roomPrefix}${++battleNum}` as RoomID;
+ } while (Rooms.rooms.has(roomid));
+>>>>>>> add github plugin
if (this.minorActivity) this.minorActivity.onConnect(user, connection);
if (this.game && this.game.onJoin) this.game.onJoin(user, connection);
From 256419de639125636c6a8b3f78abdaf12a1d85f9 Mon Sep 17 00:00:00 2001
From: Mia <49593536+maxalexandderpi@users.noreply.github.com>
Date: Mon, 29 Jun 2020 12:31:34 -0500
Subject: [PATCH 2/7] improve
---
server/chat-plugins/github.ts | 35 +++++++++++++----------------------
1 file changed, 13 insertions(+), 22 deletions(-)
diff --git a/server/chat-plugins/github.ts b/server/chat-plugins/github.ts
index d5651d11cd686..cb2870619ea47 100644
--- a/server/chat-plugins/github.ts
+++ b/server/chat-plugins/github.ts
@@ -18,14 +18,14 @@ export const github = githubhook({
github.on(
'push',
(repo: string, ref: string, result: AnyObject) => {
- return GithubParser.push(repo, ref, result)
+ return GithubParser.push(repo, ref, result);
}
);
github.on(
'pull_request',
(repo: string, ref: string, result: AnyObject) => {
- return GithubParser.pull(repo, ref, result)
+ return GithubParser.pull(repo, ref, result);
}
);
export const GithubParser = new class {
@@ -56,20 +56,20 @@ export const GithubParser = new class {
}
push(repo: string, ref: string, result: AnyObject) {
const url = result.compare;
- let buf = result.commits.map((commit: AnyObject) => {
+ const buffer = result.commits.map((commit: AnyObject) => {
const message = commit.message;
const shortMessage = /.+/.exec(message)![0];
const id = commit.id.slice(0, 6);
const formattedRepo = `[${this.repository(repo)}]`;
const userName = Utils.html`(${this.getName(commit.author.name)})`;
- return `${formattedRepo} ${id} ${shortMessage} ${userName}`
+ return `${formattedRepo} ${id} ${shortMessage} ${userName}`;
}).join('
');
if (!this.pushes[repo]) this.pushes[repo] = {};
this.pushes[repo][result.pusher.name] = Date.now();
- this.report(buf);
+ this.report(buffer);
}
pull(repo: string, ref: string, result: AnyObject) {
- let committer = toID(result.sender.login);
+ const committer = toID(result.sender.login);
if (this.gitbans.has(committer)) return;
const num = result.pull_request.number;
const url = result.pull_request.html_url;
@@ -80,24 +80,15 @@ export const GithubParser = new class {
action = 'updated';
}
if (action === 'review_requested') {
- action = 'requested a review for'
- }
- // filter code from github bot
- // Marking a PR as ready for review after drafting isn't really important
- if (action === 'ready_for_review') {
- return;
- }
- // Nobody cares about labels
- if (action === 'labeled' || action === 'unlabeled') {
- return;
+ action = 'requested a review for';
}
- // not really important to see converting open to draft
- if (action === 'converted_to_draft') {
+ const blacklisted = ['converted_to_draft', 'ready_for_review', 'converted_to_draft'];
+ if (blacklisted.includes(action)) {
return;
}
this.report(
`[${repo}] ${name} ` +
- `${action} PR#${num}: ${title}`
+ `${action} PR#${num}: ${title}`
);
}
getName(name: string) {
@@ -112,7 +103,7 @@ export const GithubParser = new class {
}
return name;
}
-}
+};
export const commands: ChatCommands = {
git: 'github',
@@ -146,7 +137,7 @@ export const commands: ChatCommands = {
},
setname(target, room, user) {
if (room.roomid !== 'development') return this.errorReply(`This command can only be used in the Development room.`);
- if (!this.can('declare', null, room)) return false;
+ if (!this.can('ban', null, room)) return false;
const [oldID, newName] = target.split(',');
if (!target || !oldID || !newName) return this.errorReply(`Specify a GitHub username and new name.`);
// @ts-ignore
@@ -163,7 +154,7 @@ export const commands: ChatCommands = {
},
resetname(target, room, user) {
if (room.roomid !== 'development') return this.errorReply(`This command can only be used in the Development room.`);
- if (!this.can('declare', null, room)) return false;
+ if (!this.can('ban', null, room)) return false;
if (!target) return this.errorReply(`Specify a name.`);
// @ts-ignore
if (!(target in room.settings.usernames)) {
From e041e8bde6909cc1d4d9b8b6a6125984ee8a7622 Mon Sep 17 00:00:00 2001
From: Mia <49593536+maxalexandderpi@users.noreply.github.com>
Date: Mon, 29 Jun 2020 23:45:09 -0500
Subject: [PATCH 3/7] ok
---
lib/utils.ts | 57 +++++++++++++++++++++++++++++++++++++++++++++++++++-
1 file changed, 56 insertions(+), 1 deletion(-)
diff --git a/lib/utils.ts b/lib/utils.ts
index 6ce0cc8d60c6f..ce1165ca828d7 100644
--- a/lib/utils.ts
+++ b/lib/utils.ts
@@ -14,7 +14,8 @@
* - A lot of Chat functions are kind of iffy, but I'm going to say for now
* that if it's English-specific, it should be left out of here.
*/
-
+import {Net} from './net';
+import * as crypto from 'crypto';
type Comparable = number | string | boolean | Comparable[] | {reverse: Comparable};
export const Utils = new class Utils {
@@ -302,4 +303,58 @@ export const Utils = new class Utils {
// Step 7
return d[n][m];
}
+ async namecolor(name: string): Promise {
+ const config = Net('https://play.pokemonshowdown.com/config/config.js');
+ const customcolors: {[k: string]: string} = await config.get().then(res => {
+ return eval(res);
+ });
+ const HSLToRGB = (H: number, S: number, L: number) => {
+ let C = (100 - Math.abs(2 * L - 100)) * S / 100 / 100;
+ let X = C * (1 - Math.abs((H / 60) % 2 - 1));
+ let m = L / 100 - C / 2;
+
+ let R1;
+ let G1;
+ let B1;
+ switch (Math.floor(H / 60)) {
+ case 1: R1 = X; G1 = C; B1 = 0; break;
+ case 2: R1 = 0; G1 = C; B1 = X; break;
+ case 3: R1 = 0; G1 = X; B1 = C; break;
+ case 4: R1 = X; G1 = 0; B1 = C; break;
+ case 5: R1 = C; G1 = 0; B1 = X; break;
+ case 0: default: R1 = C; G1 = X; B1 = 0; break;
+ }
+ let R = R1 + m;
+ let G = G1 + m;
+ let B = B1 + m;
+ return {R, G, B};
+ }
+ if (customcolors[name]) return this.namecolor(customcolors[name]);
+ let hash = crypto.createHash('md5').update(name).digest('hex');
+ let H = parseInt(hash.substr(4, 4), 16) % 360; // 0 to 360
+ let S = parseInt(hash.substr(0, 4), 16) % 50 + 40; // 40 to 89
+ let L = Math.floor(parseInt(hash.substr(8, 4), 16) % 20 + 30); // 30 to 49
+
+ let {R, G, B} = HSLToRGB(H, S, L);
+ let lum = R * R * R * 0.2126 + G * G * G * 0.7152 + B * B * B * 0.0722; // 0.013 (dark blue) to 0.737 (yellow)
+
+ let HLmod = (lum - 0.2) * -150; // -80 (yellow) to 28 (dark blue)
+ if (HLmod > 18) HLmod = (HLmod - 18) * 2.5;
+ else if (HLmod < 0) HLmod = (HLmod - 0) / 3;
+ else HLmod = 0;
+ // let mod = ';border-right: ' + Math.abs(HLmod) + 'px solid ' + (HLmod > 0 ? 'red' : '#0088FF');
+ let Hdist = Math.min(Math.abs(180 - H), Math.abs(240 - H));
+ if (Hdist < 15) {
+ HLmod += (15 - Hdist) / 3;
+ }
+
+ L += HLmod;
+
+ let {R: r, G: g, B: b} = HSLToRGB(H, S, L);
+ const toHex = (x: number) => {
+ const hex = Math.round(x * 255).toString(16);
+ return hex.length === 1 ? '0' + hex : hex;
+ };
+ return `#${toHex(r)}${toHex(g)}${toHex(b)}`;
+ }
};
From 391e63bd0d645ed522adf183f0d8766e094d3dac Mon Sep 17 00:00:00 2001
From: Mia <49593536+maxalexandderpi@users.noreply.github.com>
Date: Wed, 1 Jul 2020 23:28:52 -0500
Subject: [PATCH 4/7] ok
---
lib/utils.ts | 14 ++++++++++++--
1 file changed, 12 insertions(+), 2 deletions(-)
diff --git a/lib/utils.ts b/lib/utils.ts
index ce1165ca828d7..7bf6cf35c2c43 100644
--- a/lib/utils.ts
+++ b/lib/utils.ts
@@ -305,8 +305,18 @@ export const Utils = new class Utils {
}
async namecolor(name: string): Promise {
const config = Net('https://play.pokemonshowdown.com/config/config.js');
- const customcolors: {[k: string]: string} = await config.get().then(res => {
- return eval(res);
+ const customcolors = await config.get().then(res => {
+ const idx = res.indexOf(' = {');
+ res = res.slice(idx + 4);
+ const colors: {[k: string]: string} = {};
+ for (const line of res.split('\n')) {
+ const [name, base] = line.split(':')
+ .map(item => item.split('//')[0])
+ .map(toID).filter(Boolean);
+ if (!base || !name) continue;
+ colors[name] = base;
+ }
+ return colors;
});
const HSLToRGB = (H: number, S: number, L: number) => {
let C = (100 - Math.abs(2 * L - 100)) * S / 100 / 100;
From 8d5954a1f2a8b704d3bda9347f18d1f7cfdb92cc Mon Sep 17 00:00:00 2001
From: Mia <49593536+maxalexandderpi@users.noreply.github.com>
Date: Thu, 16 Jul 2020 17:19:58 -0500
Subject: [PATCH 5/7] names and stuff
---
server/chat-plugins/github.ts | 127 +++++++++++++++++++++-------------
1 file changed, 78 insertions(+), 49 deletions(-)
diff --git a/server/chat-plugins/github.ts b/server/chat-plugins/github.ts
index cb2870619ea47..8e094bc1c63c6 100644
--- a/server/chat-plugins/github.ts
+++ b/server/chat-plugins/github.ts
@@ -6,6 +6,7 @@
// @ts-ignore old enough module it has no types
import * as githubhook from 'githubhook';
import {Utils} from '../../lib/utils';
+import {FS} from '../../lib/fs';
const cooldown = 15 * 60 * 1000;
const rooms: RoomID[] = Config.github?.rooms ? Config.github.rooms : ['staff', 'upperstaff', 'development'];
@@ -15,6 +16,26 @@ export const github = githubhook({
secret: (Config.github?.secret || ''),
});
+interface GithubData {
+ names: {[k: string]: string};
+ bans: string[];
+ repos: {[k: string]: string};
+}
+
+export let gitData: GithubData = {
+ bans: ['dependabot-preview[bot]'],
+ names: {},
+ repos: {
+ 'pokemon-showdown': 'server',
+ 'pokemon-showdown-client': 'client',
+ 'Pokemon-Showdown-Dex': 'dex',
+ },
+};
+
+try {
+ gitData = JSON.parse(FS('config/chat-plugins/github.json').readIfExistsSync());
+} catch (e) {};
+
github.on(
'push',
(repo: string, ref: string, result: AnyObject) => {
@@ -29,30 +50,26 @@ github.on(
}
);
export const GithubParser = new class {
- gitbans: Map;
pushes: AnyObject;
constructor() {
this.pushes = {};
- this.gitbans = new Map();
- this.gitbans.set('dependabot-preview[bot]', 'always');
}
shouldShow(id: string, repo: string) {
- id = toID(id);
- if (!this.pushes[id]) return true;
- if (this.gitbans.has(id)) return false;
+ if (gitData.bans.includes(id)) return false;
if (!this.pushes[repo]) this.pushes[repo] = {};
- if (Date.now() - this.pushes[repo][id] < cooldown) return true;
- if (Date.now() - this.pushes[repo][id] > cooldown) this.pushes[repo][id] = Date.now();
+ if (Date.now() - this.pushes[repo][id] > cooldown) return true;
+ if (Date.now() - this.pushes[repo][id] < cooldown) this.pushes[repo][id] = Date.now();
return false;
}
repository(repo: string) {
- if (repo.includes('client')) return `client`;
- if (repo === 'pokemon-showdown') return `server`;
- if (repo.includes(`dex`)) return `dex`;
+ if (gitData.repos[repo]) return gitData.repos[repo];
return repo;
}
+ save() {
+ FS('config/chat-plugins/github.json').writeUpdate(() => JSON.stringify(gitData));
+ }
report(html: string) {
- Rooms.global.notifyRooms(rooms, `|c|~|/uhtml github,${html}
`);
+ Rooms.global.notifyRooms(rooms, `|c|&|/uhtml github,${html}
`);
}
push(repo: string, ref: string, result: AnyObject) {
const url = result.compare;
@@ -61,20 +78,22 @@ export const GithubParser = new class {
const shortMessage = /.+/.exec(message)![0];
const id = commit.id.slice(0, 6);
const formattedRepo = `[${this.repository(repo)}]`;
- const userName = Utils.html`(${this.getName(commit.author.name)})`;
+ const userName = Utils.html`(${this.getName(result.sender.login)})`;
return `${formattedRepo} ${id} ${shortMessage} ${userName}`;
}).join('
');
if (!this.pushes[repo]) this.pushes[repo] = {};
+ if (!this.shouldShow(result.sender.login, repo)) return;
this.pushes[repo][result.pusher.name] = Date.now();
this.report(buffer);
}
pull(repo: string, ref: string, result: AnyObject) {
const committer = toID(result.sender.login);
- if (this.gitbans.has(committer)) return;
+ if (gitData.bans.includes(committer)) return;
const num = result.pull_request.number;
const url = result.pull_request.html_url;
const title = result.pull_request.title;
const name = this.getName(result.sender.login);
+ if (!this.shouldShow(result.sender.login, repo)) return;
let action = result.action;
if (action === 'synchronize') {
action = 'updated';
@@ -92,80 +111,90 @@ export const GithubParser = new class {
);
}
getName(name: string) {
- const devRoom = Rooms.get('development');
- if (!devRoom) return name;
- // @ts-ignore
- if (!devRoom.settings.usernames) devRoom.settings.usernames = {};
- // @ts-ignore
- if (devRoom.settings.usernames[name]) {
- // @ts-ignore
- return devRoom.settings.usernames[name];
- }
+ if (gitData.names[name]) return gitData.names[name];
return name;
}
};
export const commands: ChatCommands = {
git: 'github',
+ gh: 'github',
github: {
ban(target, room, user) {
+ if (!room) return this.requiresRoom();
if (room.roomid !== 'development') return this.errorReply(`This command can only be used in the Development room.`);
- target = toID(target);
if (!this.can('mute', null, room)) return false;
- if (GithubParser.gitbans.has(target)) return this.errorReply(`${target} is already gitbanned.`);
- GithubParser.gitbans.set(target, Date.now());
+ if (gitData.bans.includes(target)) return this.errorReply(`${target} is already gitbanned.`);
+ gitData.bans.push(target);
+ GithubParser.save();
this.privateModAction(`(${user.name} prevented ${target} from being reported by the plugin.)`);
return this.modlog('GITBAN', null, target);
},
unban(target, room, user) {
+ if (!room) return this.requiresRoom();
if (room.roomid !== 'development') return this.errorReply(`This command can only be used in the Development room.`);
- target = toID(target);
if (!this.can('mute', null, room)) return false;
- if (!GithubParser.gitbans.has(target)) return this.errorReply(`${target} is not gitbanned.`);
- GithubParser.gitbans.delete(target);
+ const index = gitData.bans.indexOf(target);
+ if (index < 0) return this.errorReply(`${target} is not gitbanned.`);
+ gitData.bans.splice(index, 1);
+ GithubParser.save();
this.privateModAction(`(${user.name} allowed ${target} to be reported by the plugin.)`);
return this.modlog('UNGITBAN', null, target);
},
bans(target, room, user) {
+ if (!room) return this.requiresRoom();
if (room.roomid !== 'development') return this.errorReply(`This command can only be used in the Development room.`);
if (!this.can('mute', null, room)) return false;
let buf = `IDs banned from being reported by the Github Plugin:
`;
- for (const [id, time] of GithubParser.gitbans) {
- buf += `- ${id}: ${typeof time === 'number' ? Chat.toTimestamp(new Date(time)) : time}
`;
+ for (const id of gitData.bans) {
+ buf += `- ${id}
`;
}
return this.sendReplyBox(buf);
},
setname(target, room, user) {
+ if (!room) return this.requiresRoom();
if (room.roomid !== 'development') return this.errorReply(`This command can only be used in the Development room.`);
if (!this.can('ban', null, room)) return false;
const [oldID, newName] = target.split(',');
if (!target || !oldID || !newName) return this.errorReply(`Specify a GitHub username and new name.`);
- // @ts-ignore
- if (!room.settings.usernames) room.settings.usernames = {};
- // @ts-ignore
- if (room.settings.usernames[oldID] && room.settings.usernames[oldID] === newName) {
- return this.errorReply(`${oldID}'s GitHub plugin name is already ${newName}.`);
- }
- // @ts-ignore
- room.settings.usernames[oldID] = newName;
- room.saveSettings();
- this.sendReply(`Set ${oldID}'s name to be ${newName} in the Github Plugin.`);
+ if (gitData.names[oldID] === newName) return this.errorReply("That Git ID is already set to that name.");
+ gitData.names[oldID] = newName;
+ GithubParser.save();
+ this.privateModAction(`(${user.name} set ${oldID}'s name to be ${newName} in the Github Plugin.)`);
this.modlog(`GIT NAME`, null, `"${oldID}" to "${newName}"`);
},
resetname(target, room, user) {
+ if (!room) return this.requiresRoom();
if (room.roomid !== 'development') return this.errorReply(`This command can only be used in the Development room.`);
if (!this.can('ban', null, room)) return false;
if (!target) return this.errorReply(`Specify a name.`);
- // @ts-ignore
- if (!(target in room.settings.usernames)) {
- return this.errorReply(`${target} does not have a name set for the Github Plugin.`);
- }
- // @ts-ignore
- delete room.settings.usernames[target];
- room.saveSettings();
- this.sendReply(`Reset ${target}'s name in the Github Plugin.`);
+ if (!gitData.names[target]) return this.errorReply("That Git ID does not have a name set.");
+ delete gitData.names[target];
+ GithubParser.save();
+ this.privateModAction(`(${user.name} reset ${target}'s name in the Github Plugin.)`);
return this.modlog(`GIT RESETNAME`, null, `${target}`);
},
+ reponame(target, room, user) {
+ if (!room) return this.requiresRoom();
+ if (room.roomid !== 'development') return this.errorReply(`This command can only be used in the Development room.`);
+ if (!this.can('ban', null, room)) return false;
+ const [oldRepo, newName] = target.split(',');
+ if (!oldRepo || !newName) return this.errorReply("Specify a repo name and a new name to display.");
+ gitData.repos[oldRepo] = newName;
+ GithubParser.save();
+ this.privateModAction(`(${user.name} set the repo ${oldRepo}'s name in the Github Plugin to ${newName}.)`);
+ return this.modlog(`GIT REPONAME`, null, `${target}`);
+ },
+ resetreponame(target, room, user) {
+ if (!room) return this.requiresRoom();
+ if (room.roomid !== 'development') return this.errorReply(`This command can only be used in the Development room.`);
+ if (!this.can('ban', null, room)) return false;
+ if (!gitData.repos[target]) return this.errorReply(`${target} does not have a name in the Github Plugin.`);
+ delete gitData.repos[target];
+ GithubParser.save();
+ this.privateModAction(`(${user.name} reset the repo ${target}'s name in the Github Plugin.)`);
+ return this.modlog(`GIT RESETREPONAME`, null, `${target}`);
+ },
},
};
From 72927b7db595a70c8522d7e8b6f2ccbcbb4c59d9 Mon Sep 17 00:00:00 2001
From: Mia <49593536+maxalexandderpi@users.noreply.github.com>
Date: Thu, 16 Jul 2020 17:22:48 -0500
Subject: [PATCH 6/7] ok
---
server/chat-commands/info.ts | 5 --
server/chat-plugins/youtube.ts | 53 -------------------
server/rooms.ts | 94 ----------------------------------
3 files changed, 152 deletions(-)
diff --git a/server/chat-commands/info.ts b/server/chat-commands/info.ts
index 716a9e7020b62..b9c0471fa897a 100644
--- a/server/chat-commands/info.ts
+++ b/server/chat-commands/info.ts
@@ -1617,12 +1617,7 @@ export const commands: ChatCommands = {
);
},
-<<<<<<< HEAD
suggestions(target, room, user) {
-=======
- '!suggestion': true,
- suggestion(target, room, user) {
->>>>>>> add github plugin
if (!this.runBroadcast()) return;
this.sendReplyBox(`Make a suggestion for Pokémon Showdown`);
},
diff --git a/server/chat-plugins/youtube.ts b/server/chat-plugins/youtube.ts
index da7f1464d3fbd..4addaf4014172 100644
--- a/server/chat-plugins/youtube.ts
+++ b/server/chat-plugins/youtube.ts
@@ -293,16 +293,9 @@ export function destroy() {
export const commands: ChatCommands = {
async randchannel(target, room, user) {
-<<<<<<< HEAD
room = this.requireRoom('youtube' as RoomID);
if (Object.keys(YouTube.data.channels).length < 1) return this.errorReply(`No channels in the database.`);
target = toID(target);
-=======
- if (!room) return this.requiresRoom();
- if (room.roomid !== 'youtube') return this.errorReply(`This command can only be used in the YouTube room.`);
- if (!Config.youtubeKey) return this.errorReply(`Youtube is not configured.`);
- if (Object.keys(channelData).length < 1) return this.errorReply(`No channels in the database.`);
->>>>>>> add github plugin
this.runBroadcast();
const data = await YouTube.randChannel(target);
return this.sendReplyBox(data);
@@ -312,17 +305,10 @@ export const commands: ChatCommands = {
yt: 'youtube',
youtube: {
async addchannel(target, room, user) {
-<<<<<<< HEAD
room = this.requireRoom('youtube' as RoomID);
this.checkCan('mute', null, room);
let [id, name] = target.split(',');
if (name) name = name.trim();
-=======
- if (!room) return this.requiresRoom();
- if (room.roomid !== 'youtube') return this.errorReply(`This command can only be used in the YouTube room.`);
- if (!Config.youtubeKey) return this.errorReply(`Youtube is not configured.`);
- const [id, name] = target.split(',');
->>>>>>> add github plugin
if (!id) return this.errorReply('Specify a channel ID.');
await YouTube.getChannelData(id, name);
this.modlog('ADDCHANNEL', null, `${id} ${name ? `username: ${name}` : ''}`);
@@ -345,13 +331,7 @@ export const commands: ChatCommands = {
removechannelhelp: [`/youtube removechannel - Delete channel data from the YouTube database. Requires: % @ #`],
async channel(target, room, user) {
-<<<<<<< HEAD
room = this.requireRoom('youtube' as RoomID);
-=======
- if (!room) return this.requiresRoom();
- if (room.roomid !== 'youtube') return this.errorReply(`This command can only be used in the YouTube room.`);
- if (!Config.youtubeKey) return this.errorReply(`Youtube is not configured.`);
->>>>>>> add github plugin
const channel = YouTube.channelSearch(target);
if (!channel) return this.errorReply(`No channels with ID or name ${target} found.`);
const data = await YouTube.generateChannelDisplay(channel);
@@ -361,37 +341,13 @@ export const commands: ChatCommands = {
channelhelp: [
'/youtube channel - View the data of a specified channel. Can be either channel ID or channel name.',
],
-<<<<<<< HEAD
video() {
return this.errorReply(`Use /show instead.`);
-=======
- async video(target, room, user) {
- if (!room) return this.requiresRoom();
- if (room.roomid !== 'youtube') return this.errorReply(`This command can only be used in the YouTube room.`);
- if (!Config.youtubeKey) return this.errorReply(`Youtube is not configured.`);
- if (!target) return this.errorReply(`Provide a valid youtube link.`);
- const html = await YouTube.generateVideoDisplay(target);
- if (!html) return this.errorReply(`This url is invalid. Please use a youtu.be link or a youtube.com link.`);
- this.runBroadcast();
- if (this.broadcasting) {
- this.addBox(html);
- return room.update();
- } else {
- return this.sendReplyBox(html);
- }
->>>>>>> add github plugin
},
channels(target, room, user) {
-<<<<<<< HEAD
target = toID(target);
return this.parse(`/j view-channels${target ? `-${target}` : ''}`);
-=======
- let all;
- if (toID(target) === 'all') all = true;
- if (!Config.youtubeKey) return this.errorReply(`Youtube is not configured.`);
- return this.parse(`/j view-channels${all ? '-all' : ''}`);
->>>>>>> add github plugin
},
help(target, room, user) {
return this.parse('/help youtube');
@@ -413,7 +369,6 @@ export const commands: ChatCommands = {
YouTube.save();
},
interval: 'repeat',
-<<<<<<< HEAD
repeat(target, room, user) {
room = this.requireRoom('youtube' as RoomID);
this.checkCan('declare', null, room);
@@ -421,14 +376,6 @@ export const commands: ChatCommands = {
if (!YouTube.interval) return this.errorReply(`The YouTube plugin is not currently running an interval.`);
return this.sendReply(`Interval is currently set to ${Chat.toDurationString(YouTube.intervalTime * 60 * 1000)}.`);
}
-=======
- async repeat(target, room, user) {
- if (!room) return this.requiresRoom();
- if (room.roomid !== 'youtube') return this.errorReply(`This command can only be used in the YouTube room.`);
- if (!Config.youtubeKey) return this.errorReply(`Youtube is not configured.`);
- if (!this.can('declare', null, room)) return false;
- if (!target) return this.sendReply(`Interval is currently set to ${Chat.toDurationString(YouTube.intervalTime)}.`);
->>>>>>> add github plugin
if (Object.keys(channelData).length < 1) return this.errorReply(`No channels in the database.`);
if (isNaN(parseInt(target))) return this.errorReply(`Specify a number (in minutes) for the interval.`);
YouTube.runInterval(target);
diff --git a/server/rooms.ts b/server/rooms.ts
index 22ff80fbf08d4..81ddfebfaa590 100644
--- a/server/rooms.ts
+++ b/server/rooms.ts
@@ -568,77 +568,12 @@ export abstract class BasicRoom {
return successUserid;
}
-<<<<<<< HEAD
logUserStats() {
let total = 0;
let guests = 0;
const groups: {[k: string]: number} = {};
for (const group of Config.groupsranking) {
groups[group] = 0;
-=======
- onUpdateIdentity(user: User) {}
- destroy() {}
-}
-
-export class GlobalRoom extends BasicRoom {
- readonly type: 'global';
- readonly active: false;
- readonly settingsList: RoomSettings[];
- readonly chatRooms: ChatRoom[];
- /**
- * Rooms that users autojoin upon connecting
- */
- readonly autojoinList: RoomID[];
- /**
- * Rooms that staff autojoin upon connecting
- */
- readonly staffAutojoinList: RoomID[];
- readonly ladderIpLog: WriteStream;
- readonly users: UserTable;
- readonly reportUserStatsInterval: NodeJS.Timeout;
- readonly modlogStream: WriteStream;
- lockdown: boolean | 'pre' | 'ddos';
- battleCount: number;
- lastReportedCrash: number;
- lastBattle: number;
- lastWrittenBattle: number;
- userCount: number;
- maxUsers: number;
- maxUsersDate: number;
- formatList: string;
-
- readonly game: null;
- readonly battle: null;
- readonly tour: null;
-
- constructor(roomid: RoomID) {
- if (roomid !== 'global') throw new Error(`The global room's room ID must be 'global'`);
- super(roomid);
-
- this.type = 'global';
- this.active = false;
- this.settingsList = [];
- try {
- this.settingsList = require('../config/chatrooms.json');
- if (!Array.isArray(this.settingsList)) this.settingsList = [];
- } catch (e) {} // file doesn't exist [yet]
-
- if (!this.settingsList.length) {
- this.settingsList = [{
- title: 'Lobby',
- auth: {},
- creationTime: Date.now(),
- isOfficial: true,
- autojoin: true,
- }, {
- title: 'Staff',
- auth: {},
- creationTime: Date.now(),
- isPrivate: true,
- staffRoom: true,
- staffAutojoin: true,
- }];
->>>>>>> add github plugin
}
for (const i in this.users) {
const user = this.users[i];
@@ -868,39 +803,10 @@ export class GlobalRoom extends BasicRoom {
if (user.named) {
this.reportJoin('j', user.getIdentityWithStatus(this.roomid), user);
}
-
-<<<<<<< HEAD
const staffIntro = this.getStaffIntroMessage(user);
if (staffIntro) this.sendUser(user, staffIntro);
-
-=======
-<<<<<<< HEAD
->>>>>>> add github plugin
this.users[user.id] = user;
this.userCount++;
-=======
- const settings = {
- title,
- auth: {},
- creationTime: Date.now(),
- };
- const room = Rooms.createChatRoom(id, title, settings);
- if (id === 'lobby') Rooms.lobby = room;
- this.settingsList.push(settings);
- this.chatRooms.push(room);
- this.writeChatRoomData();
- return true;
- }
-
- prepBattleRoom(format: string) {
- // console.log('BATTLE START BETWEEN: ' + p1.id + ' ' + p2.id);
- const roomPrefix = `battle-${toID(Dex.getFormat(format).name)}-`;
- let battleNum = this.lastBattle;
- let roomid: RoomID;
- do {
- roomid = `${roomPrefix}${++battleNum}` as RoomID;
- } while (Rooms.rooms.has(roomid));
->>>>>>> add github plugin
if (this.minorActivity) this.minorActivity.onConnect(user, connection);
if (this.game && this.game.onJoin) this.game.onJoin(user, connection);
From 81b81cbf9e34f971e1e67d258d50f35eb1b2f375 Mon Sep 17 00:00:00 2001
From: Mia <49593536+mia-pi-git@users.noreply.github.com>
Date: Mon, 2 Nov 2020 08:27:02 -0600
Subject: [PATCH 7/7] OK
---
config/formats.ts | 10 --
data/abilities.ts | 8 --
data/formats-data.ts | 190 ----------------------------------
data/moves.ts | 8 --
data/random-teams.ts | 39 -------
lib/repl.ts | 15 ---
server/chat-plugins/github.ts | 53 ++++------
7 files changed, 22 insertions(+), 301 deletions(-)
diff --git a/config/formats.ts b/config/formats.ts
index c0507800b934d..de0f91e8a0122 100644
--- a/config/formats.ts
+++ b/config/formats.ts
@@ -161,19 +161,10 @@ export const Formats: FormatList = [
mod: 'gen8',
ruleset: ['Same Type Clause', 'Standard', 'Dynamax Clause'],
banlist: [
-<<<<<<< HEAD
'Blaziken', 'Calyrex-Ice', 'Calyrex-Shadow', 'Dialga', 'Eternatus', 'Genesect', 'Giratina', 'Groudon', 'Ho-Oh', 'Kyogre', 'Kyurem-White',
'Lugia', 'Lunala', 'Magearna', 'Marshadow', 'Mewtwo', 'Naganadel', 'Necrozma-Dawn-Wings', 'Necrozma-Dusk-Mane', 'Palkia', 'Pheromosa',
'Rayquaza', 'Reshiram', 'Solgaleo', 'Xerneas', 'Yveltal', 'Zacian', 'Zamazenta', 'Zekrom', 'Zygarde-Base',
'Moody', 'Power Construct', 'Shadow Tag', 'Terrain Extender', 'Baton Pass',
-=======
-<<<<<<< HEAD
- 'Eternatus', 'Kyurem-Black', 'Kyurem-White', 'Lunala', 'Magearna', 'Marshadow', 'Melmetal', 'Mewtwo', 'Necrozma-Dawn-Wings',
- 'Necrozma-Dusk-Mane', 'Reshiram', 'Solgaleo', 'Urshifu-Rapid-Strike', 'Zacian', 'Zamazenta', 'Zekrom',
-=======
- 'Eternatus', 'Kyurem-Black', 'Kyurem-White', 'Lunala', 'Magearna', 'Marshadow', 'Melmetal', 'Mewtwo',
- 'Necrozma-Dawn-Wings', 'Necrozma-Dusk-Mane', 'Reshiram', 'Solgaleo', 'Zacian', 'Zamazenta', 'Zekrom',
->>>>>>> add github plugin
'Damp Rock', 'Smooth Rock', 'Moody', 'Shadow Tag', 'Baton Pass',
],
},
@@ -191,7 +182,6 @@ export const Formats: FormatList = [
name: "[Gen 8] ZU",
threads: [
`• ZU Metagame Discussion`,
->>>>>>> add github plugin
],
},
{
diff --git a/data/abilities.ts b/data/abilities.ts
index 697e33d30bdf4..6397e21bf74ef 100644
--- a/data/abilities.ts
+++ b/data/abilities.ts
@@ -2816,15 +2816,7 @@ export const Abilities: {[abilityid: string]: AbilityData} = {
}
},
name: "Quick Draw",
-<<<<<<< HEAD
- rating: 2.5,
-=======
-<<<<<<< HEAD
- rating: 3,
-=======
rating: 2,
->>>>>>> add github plugin
->>>>>>> add github plugin
num: 259,
},
quickfeet: {
diff --git a/data/formats-data.ts b/data/formats-data.ts
index 9281ea5257a02..bfd13a42b51fe 100644
--- a/data/formats-data.ts
+++ b/data/formats-data.ts
@@ -280,22 +280,12 @@ export const FormatsData: {[k: string]: SpeciesFormatsData} = {
doublesTier: "(DUU)",
},
sandslashalola: {
-<<<<<<< HEAD
randomBattleMoves: ["earthquake", "ironhead", "knockoff", "rapidspin", "swordsdance", "tripleaxel"],
-=======
- randomBattleMoves: ["earthquake", "ironhead", "knockoff", "rapidspin", "stealthrock", "swordsdance", "tripleaxel"],
-<<<<<<< HEAD
->>>>>>> add github plugin
randomBattleLevel: 86,
randomDoubleBattleMoves: ["drillrun", "ironhead", "protect", "swordsdance", "tripleaxel"],
randomDoubleBattleLevel: 84,
tier: "NU",
doublesTier: "DUU",
-=======
- randomBattleLevel: 88,
- tier: "OU",
- doublesTier: "DOU",
->>>>>>> add github plugin
},
nidoranf: {
tier: "LC",
@@ -551,26 +541,12 @@ export const FormatsData: {[k: string]: SpeciesFormatsData} = {
doublesTier: "NFE",
},
alakazam: {
-<<<<<<< HEAD
randomBattleMoves: ["counter", "focusblast", "nastyplot", "psychic", "shadowball"],
randomBattleLevel: 82,
randomDoubleBattleMoves: ["focusblast", "nastyplot", "protect", "psychic", "shadowball"],
randomDoubleBattleLevel: 80,
tier: "UU",
doublesTier: "(DUU)",
-=======
-<<<<<<< HEAD
- randomBattleMoves: ["counter", "focusblast", "nastyplot", "psychic", "psyshock", "shadowball"],
- randomBattleLevel: 80,
- randomDoubleBattleMoves: ["focusblast", "nastyplot", "protect", "psychic", "shadowball"],
- randomDoubleBattleLevel: 80,
-=======
- randomBattleMoves: ["focusblast", "nastyplot", "psychic", "psyshock", "shadowball"],
- randomBattleLevel: 80,
->>>>>>> add github plugin
- tier: "OU",
- doublesTier: "DOU",
->>>>>>> add github plugin
},
alakazammega: {
isNonstandard: "Past",
@@ -920,21 +896,11 @@ export const FormatsData: {[k: string]: SpeciesFormatsData} = {
doublesTier: "(DUU)",
},
hitmontop: {
-<<<<<<< HEAD
randomBattleMoves: ["closecombat", "earthquake", "rapidspin", "suckerpunch", "toxic", "tripleaxel"],
-=======
- randomBattleMoves: ["closecombat", "machpunch", "rapidspin", "suckerpunch", "toxic", "tripleaxel"],
-<<<<<<< HEAD
->>>>>>> add github plugin
randomBattleLevel: 86,
randomDoubleBattleMoves: ["closecombat", "coaching", "fakeout", "helpinghand", "rapidspin", "suckerpunch", "tripleaxel"],
randomDoubleBattleLevel: 88,
tier: "NU",
-=======
- randomBattleLevel: 88,
- randomDoubleBattleMoves: ["closecombat", "fakeout", "feint", "helpinghand", "rapidspin", "suckerpunch", "wideguard"],
- tier: "PU",
->>>>>>> add github plugin
doublesTier: "(DUU)",
},
lickitung: {
@@ -987,19 +953,9 @@ export const FormatsData: {[k: string]: SpeciesFormatsData} = {
},
chansey: {
randomBattleMoves: ["healbell", "seismictoss", "softboiled", "stealthrock", "toxic"],
-<<<<<<< HEAD
randomBattleLevel: 82,
tier: "UU",
doublesTier: "(DUU)",
-=======
- randomBattleLevel: 80,
-<<<<<<< HEAD
- tier: "OU",
-=======
- tier: "UUBL",
->>>>>>> add github plugin
- doublesTier: "NFE",
->>>>>>> add github plugin
},
blissey: {
randomBattleMoves: ["healbell", "protect", "seismictoss", "toxic", "wish"],
@@ -1097,20 +1053,11 @@ export const FormatsData: {[k: string]: SpeciesFormatsData} = {
},
scyther: {
randomBattleMoves: ["brickbreak", "dualwingbeat", "knockoff", "roost", "swordsdance", "uturn"],
-<<<<<<< HEAD
randomBattleLevel: 82,
randomDoubleBattleMoves: ["brickbreak", "bugbite", "dualwingbeat", "uturn"],
randomDoubleBattleLevel: 84,
tier: "UU",
-<<<<<<< HEAD
doublesTier: "LC Uber",
-=======
- doublesTier: "DUU",
-=======
- randomBattleLevel: 86,
- tier: "PUBL",
->>>>>>> add github plugin
->>>>>>> add github plugin
},
scizor: {
randomBattleMoves: ["bulletpunch", "dualwingbeat", "knockoff", "roost", "superpower", "swordsdance", "uturn"],
@@ -1731,24 +1678,12 @@ export const FormatsData: {[k: string]: SpeciesFormatsData} = {
doublesTier: "(DUU)",
},
heracross: {
-<<<<<<< HEAD
randomBattleMoves: ["closecombat", "facade", "knockoff", "megahorn", "spikes", "stoneedge"],
randomBattleLevel: 84,
randomDoubleBattleMoves: ["closecombat", "facade", "knockoff", "megahorn", "protect", "swordsdance"],
randomDoubleBattleLevel: 84,
-<<<<<<< HEAD
tier: "RUBL",
doublesTier: "(DUU)",
-=======
- tier: "UU",
- doublesTier: "DUU",
-=======
- randomBattleMoves: ["closecombat", "facade", "knockoff", "megahorn", "stoneedge", "substitute"],
- randomBattleLevel: 84,
- tier: "OU",
- doublesTier: "DOU",
->>>>>>> add github plugin
->>>>>>> add github plugin
},
heracrossmega: {
isNonstandard: "Past",
@@ -2185,14 +2120,9 @@ export const FormatsData: {[k: string]: SpeciesFormatsData} = {
},
shedinja: {
randomBattleMoves: ["poltergeist", "shadowsneak", "swordsdance", "willowisp", "xscissor"],
-<<<<<<< HEAD
randomBattleLevel: 88,
randomDoubleBattleMoves: ["allyswitch", "poltergeist", "protect", "shadowsneak", "swordsdance", "willowisp", "xscissor"],
randomDoubleBattleLevel: 88,
-=======
- randomBattleLevel: 100,
- randomDoubleBattleMoves: ["allyswitch", "protect", "shadowsneak", "swordsdance", "willowisp", "xscissor"],
->>>>>>> add github plugin
tier: "(PU)",
doublesTier: "(DUU)",
},
@@ -2346,26 +2276,12 @@ export const FormatsData: {[k: string]: SpeciesFormatsData} = {
tier: "LC",
},
sharpedo: {
-<<<<<<< HEAD
randomBattleMoves: ["closecombat", "crunch", "destinybond", "hydropump", "protect"],
-=======
- randomBattleMoves: ["closecombat", "crunch", "destinybond", "flipturn", "protect", "waterfall"],
-<<<<<<< HEAD
->>>>>>> add github plugin
randomBattleLevel: 82,
randomDoubleBattleMoves: ["closecombat", "crunch", "flipturn", "icebeam", "protect", "waterfall"],
randomDoubleBattleLevel: 84,
tier: "UU",
-<<<<<<< HEAD
doublesTier: "(DUU)",
-=======
- doublesTier: "DUU",
-=======
- randomBattleLevel: 84,
- tier: "OU",
- doublesTier: "DOU",
->>>>>>> add github plugin
->>>>>>> add github plugin
},
sharpedomega: {
isNonstandard: "Past",
@@ -4058,22 +3974,10 @@ export const FormatsData: {[k: string]: SpeciesFormatsData} = {
},
golurk: {
randomBattleMoves: ["dynamicpunch", "earthquake", "poltergeist", "rockpolish", "stoneedge"],
-<<<<<<< HEAD
randomBattleLevel: 84,
randomDoubleBattleMoves: ["dynamicpunch", "earthquake", "highhorsepower", "icepunch", "poltergeist", "protect"],
randomDoubleBattleLevel: 86,
tier: "RU",
-=======
- randomBattleLevel: 86,
-<<<<<<< HEAD
- randomDoubleBattleMoves: ["dynamicpunch", "earthquake", "highhorsepower", "icepunch", "poltergeist", "protect"],
- randomDoubleBattleLevel: 86,
- tier: "NU",
-=======
- randomDoubleBattleMoves: ["closecombat", "earthquake", "highhorsepower", "icepunch", "protect", "shadowpunch"],
- tier: "PUBL",
->>>>>>> add github plugin
->>>>>>> add github plugin
doublesTier: "(DUU)",
},
pawniard: {
@@ -4533,25 +4437,11 @@ export const FormatsData: {[k: string]: SpeciesFormatsData} = {
},
dragalge: {
randomBattleMoves: ["dracometeor", "dragonpulse", "flipturn", "focusblast", "sludgewave", "toxicspikes"],
-<<<<<<< HEAD
randomBattleLevel: 84,
randomDoubleBattleMoves: ["dracometeor", "dragonpulse", "focusblast", "protect", "sludgebomb"],
randomDoubleBattleLevel: 86,
tier: "RU",
doublesTier: "(DUU)",
-=======
-<<<<<<< HEAD
- randomBattleLevel: 82,
- randomDoubleBattleMoves: ["dracometeor", "dragonpulse", "focusblast", "protect", "sludgebomb"],
- randomDoubleBattleLevel: 86,
- tier: "UU",
- doublesTier: "DUU",
-=======
- randomBattleLevel: 84,
- tier: "OU",
- doublesTier: "DOU",
->>>>>>> add github plugin
->>>>>>> add github plugin
},
clauncher: {
tier: "LC",
@@ -4650,15 +4540,8 @@ export const FormatsData: {[k: string]: SpeciesFormatsData} = {
randomBattleMoves: ["earthquake", "hornleech", "poltergeist", "rockslide", "trickroom", "woodhammer"],
randomBattleLevel: 86,
randomDoubleBattleMoves: ["allyswitch", "poltergeist", "rockslide", "trickroom", "willowisp", "woodhammer"],
-<<<<<<< HEAD
randomDoubleBattleLevel: 88,
-<<<<<<< HEAD
tier: "NU",
-=======
-=======
->>>>>>> add github plugin
- tier: "PU",
->>>>>>> add github plugin
doublesTier: "(DUU)",
},
pumpkaboo: {
@@ -4699,23 +4582,10 @@ export const FormatsData: {[k: string]: SpeciesFormatsData} = {
},
gourgeistsuper: {
randomBattleMoves: ["poltergeist", "powerwhip", "rockslide", "shadowsneak", "trickroom"],
-<<<<<<< HEAD
randomBattleLevel: 88,
randomDoubleBattleMoves: ["poltergeist", "powerwhip", "protect", "shadowsneak", "trickroom"],
randomDoubleBattleLevel: 88,
tier: "PU",
-=======
-<<<<<<< HEAD
- randomBattleLevel: 86,
- randomDoubleBattleMoves: ["poltergeist", "powerwhip", "protect", "shadowsneak", "trickroom"],
- randomDoubleBattleLevel: 88,
- tier: "NU",
-=======
- randomBattleLevel: 88,
- randomDoubleBattleMoves: ["powerwhip", "protect", "shadowsneak", "synthesis", "trickroom"],
- tier: "PU",
->>>>>>> add github plugin
->>>>>>> add github plugin
doublesTier: "(DUU)",
},
bergmite: {
@@ -5586,23 +5456,12 @@ export const FormatsData: {[k: string]: SpeciesFormatsData} = {
doublesTier: "DUU",
},
rillaboom: {
-<<<<<<< HEAD
randomBattleMoves: ["grassyglide", "highhorsepower", "knockoff", "uturn", "woodhammer"],
-=======
- randomBattleMoves: ["acrobatics", "grassyglide", "highhorsepower", "knockoff", "swordsdance", "uturn", "woodhammer"],
-<<<<<<< HEAD
->>>>>>> add github plugin
randomBattleLevel: 80,
randomDoubleBattleMoves: ["fakeout", "grassyglide", "highhorsepower", "protect", "uturn", "woodhammer"],
randomDoubleBattleLevel: 80,
tier: "OU",
doublesTier: "DOU",
-=======
- randomBattleLevel: 84,
- randomDoubleBattleMoves: ["drumbeating", "fakeout", "highhorsepower", "protect", "superpower", "uturn", "woodhammer"],
- tier: "RU",
- doublesTier: "DUU",
->>>>>>> add github plugin
},
rillaboomgmax: {
randomBattleMoves: ["acrobatics", "grassyglide", "highhorsepower", "knockoff", "swordsdance"],
@@ -6033,20 +5892,10 @@ export const FormatsData: {[k: string]: SpeciesFormatsData} = {
},
indeedeef: {
randomBattleMoves: ["calmmind", "expandingforce", "healingwish", "hypervoice", "mysticalfire"],
-<<<<<<< HEAD
randomBattleLevel: 84,
randomDoubleBattleMoves: ["expandingforce", "followme", "healpulse", "helpinghand", "protect"],
randomDoubleBattleLevel: 80,
-<<<<<<< HEAD
tier: "RU",
-=======
- tier: "RUBL",
-=======
- randomBattleLevel: 86,
- randomDoubleBattleMoves: ["allyswitch", "followme", "healpulse", "helpinghand", "protect", "psychic"],
- tier: "NU",
->>>>>>> add github plugin
->>>>>>> add github plugin
doublesTier: "DOU",
},
morpeko: {
@@ -6184,79 +6033,40 @@ export const FormatsData: {[k: string]: SpeciesFormatsData} = {
urshifu: {
randomBattleMoves: ["closecombat", "ironhead", "suckerpunch", "uturn", "wickedblow"],
randomBattleLevel: 80,
-<<<<<<< HEAD
randomDoubleBattleMoves: ["closecombat", "ironhead", "protect", "suckerpunch", "wickedblow"],
-<<<<<<< HEAD
randomDoubleBattleLevel: 76,
-=======
- randomDoubleBattleLevel: 80,
-=======
->>>>>>> add github plugin
->>>>>>> add github plugin
tier: "OU",
doublesTier: "DUber",
},
urshifurapidstrike: {
-<<<<<<< HEAD
randomBattleMoves: ["bulkup", "drainpunch", "substitute", "surgingstrikes"],
randomBattleLevel: 80,
randomDoubleBattleMoves: ["aquajet", "closecombat", "poisonjab", "protect", "surgingstrikes", "uturn"],
randomDoubleBattleLevel: 80,
-=======
- randomBattleMoves: ["closecombat", "surgingstrikes", "thunderpunch", "uturn"],
- randomBattleLevel: 82,
->>>>>>> add github plugin
tier: "OU",
doublesTier: "DOU",
},
urshifugmax: {
randomBattleMoves: ["bulkup", "drainpunch", "substitute", "wickedblow"],
-<<<<<<< HEAD
randomBattleLevel: 80,
-<<<<<<< HEAD
isNonstandard: "Gigantamax",
-=======
-=======
->>>>>>> add github plugin
->>>>>>> add github plugin
tier: "(Uber)",
doublesTier: "(DUber)",
},
urshifurapidstrikegmax: {
-<<<<<<< HEAD
randomBattleMoves: ["bulkup", "closecombat", "surgingstrikes", "thunderpunch", "uturn"],
randomBattleLevel: 80,
isNonstandard: "Gigantamax",
-=======
-<<<<<<< HEAD
- randomBattleMoves: ["closecombat", "surgingstrikes", "thunderpunch", "uturn"],
- randomBattleLevel: 80,
-=======
- randomBattleMoves: ["bulkup", "drainpunch", "substitute", "surgingstrikes"],
- randomBattleLevel: 82,
->>>>>>> add github plugin
->>>>>>> add github plugin
tier: "(Uber)",
doublesTier: "(DUber)",
},
zarude: {
randomBattleMoves: ["bulkup", "closecombat", "darkestlariat", "powerwhip", "uturn"],
-<<<<<<< HEAD
randomBattleLevel: 82,
randomDoubleBattleMoves: ["closecombat", "darkestlariat", "junglehealing", "powerwhip", "protect", "rockslide"],
randomDoubleBattleLevel: 80,
tier: "UU",
doublesTier: "DUU",
-=======
- randomBattleLevel: 80,
-<<<<<<< HEAD
- randomDoubleBattleMoves: ["closecombat", "darkestlariat", "junglehealing", "powerwhip", "protect", "rockslide"],
- randomDoubleBattleLevel: 80,
-=======
->>>>>>> add github plugin
- isNonstandard: "Unobtainable",
- tier: "Unreleased",
->>>>>>> add github plugin
},
zarudedada: {
isNonstandard: "Unobtainable",
diff --git a/data/moves.ts b/data/moves.ts
index dc11890652312..76ab70e618124 100644
--- a/data/moves.ts
+++ b/data/moves.ts
@@ -12706,11 +12706,7 @@ export const Moves: {[moveid: string]: MoveData} = {
priority: 0,
flags: {protect: 1, mirror: 1},
onTry(pokemon, target) {
-<<<<<<< HEAD
if (!target.item) {
-=======
- if (!target.item || target.ignoringItem()) {
->>>>>>> add github plugin
this.attrLastMove('[still]');
this.add('-fail', pokemon);
return null;
@@ -14066,11 +14062,7 @@ export const Moves: {[moveid: string]: MoveData} = {
priority: 0,
flags: {protect: 1, mirror: 1},
onBasePower(basePower, pokemon, target) {
-<<<<<<< HEAD
if (this.field.isTerrain('electricterrain') && target.isGrounded()) {
-=======
- if (this.field.isTerrain('electricterrain') && !target.runImmunity('Ground')) {
->>>>>>> add github plugin
this.debug('terrain buff');
return this.chainModify(2);
}
diff --git a/data/random-teams.ts b/data/random-teams.ts
index fa3648a517cd0..5ec2764362054 100644
--- a/data/random-teams.ts
+++ b/data/random-teams.ts
@@ -653,15 +653,12 @@ export class RandomTeams {
case 'destinybond': case 'healbell':
if (movePool.includes('protect') || movePool.includes('wish')) rejected = true;
break;
-<<<<<<< HEAD
case 'fireblast':
if (hasAbility['Serene Grace'] && (!hasMove['trick'] || counter.Status > 1)) rejected = true;
break;
case 'firepunch':
if (movePool.includes('bellydrum') || hasMove['earthquake'] && movePool.includes('substitute')) rejected = true;
break;
-=======
->>>>>>> add github plugin
case 'flamecharge': case 'sacredsword':
if (counter.damagingMoves.length < 3 && !counter.setupType) rejected = true;
if (!hasType['Grass'] && movePool.includes('swordsdance')) rejected = true;
@@ -743,9 +740,6 @@ export class RandomTeams {
case 'fakeout':
if (counter.setupType || hasMove['protect'] || hasMove['rapidspin'] || hasMove['substitute'] || hasMove['uturn']) rejected = true;
break;
- case 'flipturn':
- if (counter.Status >= 1) rejected = true;
- break;
case 'healingwish': case 'memento':
if (counter.setupType || !!counter['recovery'] || hasMove['substitute'] || hasMove['uturn']) rejected = true;
break;
@@ -938,25 +932,9 @@ export class RandomTeams {
case 'shadowclaw':
if (hasType['Steel'] && hasMove['shadowsneak'] && counter.Physical < 4) rejected = true;
break;
-<<<<<<< HEAD
case 'dragonpulse': case 'spacialrend':
if (hasMove['dracometeor'] && counter.Special < 4) rejected = true;
break;
-<<<<<<< HEAD
-=======
- case 'outrage':
- if (counter.setupType && (hasMove['scaleshot'] || movePool.includes('scaleshot'))) rejected = true;
- break;
-=======
- case 'shadowsneak':
- if (!hasType['Ghost'] && !!counter['recovery']) rejected = true;
- if (hasMove['substitute'] || hasMove['toxic'] || hasMove['trickroom']) rejected = true;
- break;
- case 'dragonpulse': case 'outrage':
- if (hasMove['dracometeor'] && counter.Special < 4) rejected = true;
- break;
->>>>>>> add github plugin
->>>>>>> add github plugin
case 'darkpulse':
if ((hasMove['foulplay'] || hasMove['knockoff'] || hasMove['suckerpunch'] || hasMove['defog']) && counter.setupType !== 'Special') rejected = true;
if (!hasType['Dark'] && !!counter.Status) rejected = true;
@@ -1365,15 +1343,7 @@ export class RandomTeams {
item = (scarfReqs && this.randomChance(2, 3)) ? 'Choice Scarf' : 'Choice Specs';
} else if (((counter.Physical >= 3 && hasMove['defog']) || (counter.Special >= 3 && hasMove['healingwish'])) && !counter['priority'] && !hasMove['uturn'] && !isDoubles) {
item = 'Choice Scarf';
-<<<<<<< HEAD
} else if (hasMove['raindance'] || hasMove['sunnyday'] || (ability === 'Speed Boost' && !counter['hazards']) || ability === 'Stance Change' && counter.damagingMoves.length >= 3) {
-=======
-<<<<<<< HEAD
- } else if (hasMove['raindance'] || hasMove['sunnyday'] || (ability === 'Speed Boost' && hasMove['destinybond']) || ability === 'Stance Change' && counter.Physical + counter.Special > 2) {
-=======
- } else if (hasMove['raindance'] || hasMove['sunnyday'] || ability === 'Stance Change' && counter.Physical + counter.Special > 2) {
->>>>>>> add github plugin
->>>>>>> add github plugin
item = 'Life Orb';
} else if (this.dex.getEffectiveness('Rock', species) >= 1 && (['Defeatist', 'Emergency Exit', 'Multiscale'].includes(ability) || hasMove['courtchange'] || hasMove['defog'] || hasMove['rapidspin']) && !isDoubles) {
item = 'Heavy-Duty Boots';
@@ -1543,17 +1513,8 @@ export class RandomTeams {
case 'Darmanitan':
if (species.gen === 8 && this.randomChance(1, 2)) continue;
break;
-<<<<<<< HEAD
case 'Magearna': case 'Toxtricity': case 'Zacian': case 'Zamazenta':
-<<<<<<< HEAD
case 'Appletun': case 'Blastoise': case 'Butterfree': case 'Copperajah': case 'Grimmsnarl': case 'Inteleon': case 'Rillaboom': case 'Snorlax': case 'Urshifu':
-=======
- case 'Appletun': case 'Blastoise': case 'Butterfree': case 'Copperajah': case 'Grimmsnarl': case 'Snorlax': case 'Urshifu':
-=======
- case 'Appletun': case 'Butterfree': case 'Copperajah': case 'Grimmsnarl': case 'Snorlax':
- case 'Toxtricity': case 'Urshifu': case 'Zacian': case 'Zamazenta':
->>>>>>> add github plugin
->>>>>>> add github plugin
if (this.gen >= 8 && this.randomChance(1, 2)) continue;
break;
}
diff --git a/lib/repl.ts b/lib/repl.ts
index f2aeef7cab4a4..9d930c7c94c04 100644
--- a/lib/repl.ts
+++ b/lib/repl.ts
@@ -97,16 +97,12 @@ export const Repl = new class ReplSingleton {
});
server.once('error', (err: NodeJS.ErrnoException) => {
-<<<<<<< HEAD
server.close();
-=======
->>>>>>> add github plugin
if (err.code === "EADDRINUSE") {
fs.unlink(pathname, _err => {
if (_err && _err.code !== "ENOENT") {
crashlogger(_err, `REPL: ${filename}`);
}
-<<<<<<< HEAD
});
} else if (err.code === "EACCES") {
if (process.platform !== 'win32') {
@@ -114,22 +110,11 @@ export const Repl = new class ReplSingleton {
}
} else {
crashlogger(err, `REPL: ${filename}`);
-=======
- server.close();
- });
- } else {
- crashlogger(err, `REPL: ${filename}`);
- server.close();
->>>>>>> add github plugin
}
});
server.once('close', () => {
Repl.socketPathnames.delete(pathname);
-<<<<<<< HEAD
-=======
- Repl.start(filename, evalFunction);
->>>>>>> add github plugin
});
} catch (err) {
console.error(`Could not start REPL server "${filename}": ${err}`);
diff --git a/server/chat-plugins/github.ts b/server/chat-plugins/github.ts
index 8e094bc1c63c6..b7e4a63f2c939 100644
--- a/server/chat-plugins/github.ts
+++ b/server/chat-plugins/github.ts
@@ -1,7 +1,8 @@
/**
* Plugin to notify given rooms / the Development room on Pokemon Showdown
* of github updates.
- * Some html / design from xfix's github bot, plugin by mia-pi.
+ * Some html / design from xfix's github bot, plugin by Mia.
+ * @author mia-pi-git
*/
// @ts-ignore old enough module it has no types
import * as githubhook from 'githubhook';
@@ -14,6 +15,7 @@ const rooms: RoomID[] = Config.github?.rooms ? Config.github.rooms : ['staff', '
export const github = githubhook({
port: (Config.github?.port || Config.port + 1),
secret: (Config.github?.secret || ''),
+ callback: '/server/chat-plugins/github.ts',
});
interface GithubData {
@@ -36,19 +38,15 @@ try {
gitData = JSON.parse(FS('config/chat-plugins/github.json').readIfExistsSync());
} catch (e) {};
-github.on(
- 'push',
- (repo: string, ref: string, result: AnyObject) => {
- return GithubParser.push(repo, ref, result);
- }
+github.on('push',
+ (repo: string, ref: string, result: AnyObject) => GithubParser.push(repo, ref, result)
);
github.on(
'pull_request',
- (repo: string, ref: string, result: AnyObject) => {
- return GithubParser.pull(repo, ref, result);
- }
+ (repo: string, ref: string, result: AnyObject) => GithubParser.pull(repo, ref, result)
);
+
export const GithubParser = new class {
pushes: AnyObject;
constructor() {
@@ -121,9 +119,8 @@ export const commands: ChatCommands = {
gh: 'github',
github: {
ban(target, room, user) {
- if (!room) return this.requiresRoom();
- if (room.roomid !== 'development') return this.errorReply(`This command can only be used in the Development room.`);
- if (!this.can('mute', null, room)) return false;
+ room = this.requireRoom('development');
+ this.checkCan('mute', null, room);
if (gitData.bans.includes(target)) return this.errorReply(`${target} is already gitbanned.`);
gitData.bans.push(target);
GithubParser.save();
@@ -131,9 +128,8 @@ export const commands: ChatCommands = {
return this.modlog('GITBAN', null, target);
},
unban(target, room, user) {
- if (!room) return this.requiresRoom();
- if (room.roomid !== 'development') return this.errorReply(`This command can only be used in the Development room.`);
- if (!this.can('mute', null, room)) return false;
+ room = this.requireRoom('development');
+ this.checkCan('mute', null, room);
const index = gitData.bans.indexOf(target);
if (index < 0) return this.errorReply(`${target} is not gitbanned.`);
gitData.bans.splice(index, 1);
@@ -142,9 +138,8 @@ export const commands: ChatCommands = {
return this.modlog('UNGITBAN', null, target);
},
bans(target, room, user) {
- if (!room) return this.requiresRoom();
- if (room.roomid !== 'development') return this.errorReply(`This command can only be used in the Development room.`);
- if (!this.can('mute', null, room)) return false;
+ room = this.requireRoom('development');
+ this.checkCan('mute', null, room);
let buf = `IDs banned from being reported by the Github Plugin:
`;
for (const id of gitData.bans) {
buf += `- ${id}
`;
@@ -152,9 +147,8 @@ export const commands: ChatCommands = {
return this.sendReplyBox(buf);
},
setname(target, room, user) {
- if (!room) return this.requiresRoom();
- if (room.roomid !== 'development') return this.errorReply(`This command can only be used in the Development room.`);
- if (!this.can('ban', null, room)) return false;
+ room = this.requireRoom('development');
+ this.checkCan('mute', null, room);
const [oldID, newName] = target.split(',');
if (!target || !oldID || !newName) return this.errorReply(`Specify a GitHub username and new name.`);
if (gitData.names[oldID] === newName) return this.errorReply("That Git ID is already set to that name.");
@@ -164,9 +158,8 @@ export const commands: ChatCommands = {
this.modlog(`GIT NAME`, null, `"${oldID}" to "${newName}"`);
},
resetname(target, room, user) {
- if (!room) return this.requiresRoom();
- if (room.roomid !== 'development') return this.errorReply(`This command can only be used in the Development room.`);
- if (!this.can('ban', null, room)) return false;
+ room = this.requireRoom('development');
+ this.checkCan('mute', null, room);
if (!target) return this.errorReply(`Specify a name.`);
if (!gitData.names[target]) return this.errorReply("That Git ID does not have a name set.");
delete gitData.names[target];
@@ -175,10 +168,9 @@ export const commands: ChatCommands = {
return this.modlog(`GIT RESETNAME`, null, `${target}`);
},
reponame(target, room, user) {
- if (!room) return this.requiresRoom();
- if (room.roomid !== 'development') return this.errorReply(`This command can only be used in the Development room.`);
- if (!this.can('ban', null, room)) return false;
- const [oldRepo, newName] = target.split(',');
+ room = this.requireRoom('development');
+ this.checkCan('mute', null, room);
+ const [oldRepo, newName] = Utils.splitFirst(target, ',');
if (!oldRepo || !newName) return this.errorReply("Specify a repo name and a new name to display.");
gitData.repos[oldRepo] = newName;
GithubParser.save();
@@ -186,9 +178,8 @@ export const commands: ChatCommands = {
return this.modlog(`GIT REPONAME`, null, `${target}`);
},
resetreponame(target, room, user) {
- if (!room) return this.requiresRoom();
- if (room.roomid !== 'development') return this.errorReply(`This command can only be used in the Development room.`);
- if (!this.can('ban', null, room)) return false;
+ room = this.requireRoom('development');
+ this.checkCan('mute', null, room);
if (!gitData.repos[target]) return this.errorReply(`${target} does not have a name in the Github Plugin.`);
delete gitData.repos[target];
GithubParser.save();