Skip to content

fix: change link generation to new ipfs gateway #46

New issue

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

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

Already on GitHub? Sign in to your account

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

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions lib/telegram/assets/lang.json
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@
"greeting1": "Welcome, this group is moderated with ",
"greeting2": "Please make sure to follow the [community rules]",
"greeting3": "Users who break the rules can be reported by replying to a message with the command /report.",
"defaultRules": "https://ipfs.kleros.io/ipfs/QmbgRUB4dEgcvRfYmWo34GJhpBGNWWJNsbz8dxN2QLTyLb/Kleros%20Moderate%20Community%20Rules%20v1.0.pdf",
"defaultRules": "https://cdn.kleros.link/ipfs/QmbgRUB4dEgcvRfYmWo34GJhpBGNWWJNsbz8dxN2QLTyLb/Kleros%20Moderate%20Community%20Rules%20v1.0.pdf",
"defaultRulesMsg1": "The Kleros Moderate Community Guidelines apply as the default [rules]",
"defaultRulesMsg1alt": "The Kleros Moderate Community Guidelines apply as the default rules",
"defaultRulesMsg2": "Crafting precise policies can be challenging, if you are certain in setting a new policy, you can set new rules with /setrules \\[url] or /setrules \\[reply to message]"
Expand Down Expand Up @@ -163,7 +163,7 @@
"greeting1": "Welcome, this group is moderated with ",
"greeting2": "Please make sure to follow the [community rules]",
"greeting3": "Users who break the rules can be reported by replying to a message with the command /report.",
"defaultRules": "https://ipfs.kleros.io/ipfs/QmYYcNfEYLtxPM8fof4wf9Tqj7gBGMDMmNnBqZKR1zSczX/Kleros%20Moderate%20Community%20Guidelines%20v1.pdf",
"defaultRules": "https://cdn.kleros.link/ipfs/QmYYcNfEYLtxPM8fof4wf9Tqj7gBGMDMmNnBqZKR1zSczX/Kleros%20Moderate%20Community%20Guidelines%20v1.pdf",
"defaultRulesMsg1": "The Kleros Moderate Community Guidelines apply as the default [rules].",
"defaultRulesMsg2": "Crafting precise policies can be challenging, if you are certain in setting a new policy, you can set new rules with /setrules [url] or /setrules [reply to message]."
}
Expand Down
8 changes: 4 additions & 4 deletions lib/telegram/assets/langNew.json
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@
"welcome": {
"welcome": "Hi, I'm Susie, a [Kleros Moderate](https://kleros.io/moderate/) bot.\n\nI need permission from an admin to /start.\n\nHow do I help with moderation?\n\n1. I ask \"Did a user break the rules?\" on the crowdsourcing platform [Reality.Eth](https://realityeth.github.io/).\n2. The question is answered with an escalation game using xDai on [Gnosis Chain](https://www.gnosis.io/).\n3. The answer can be disputed in the [Kleros](https://kleros.io/) court.\n\nTo learn more, [DM](https://t.me/SusieTheKlerosModeratorBot?start=help) me, read my [docs](https://kleros.gitbook.io/docs/products/moderate/susie), or ask a question in @SusieSupport."
},
"defaultRules": "https://ipfs.kleros.io/ipfs/Qme3Qbj9rKUNHUe9vj9rqCLnTVUCWKy2YfveQF8HiuWQSu/Kleros%20Moderate%20Community%20Rules.pdf",
"defaultRules": "https://cdn.kleros.link/ipfs/Qme3Qbj9rKUNHUe9vj9rqCLnTVUCWKy2YfveQF8HiuWQSu/Kleros%20Moderate%20Community%20Rules.pdf",
"index": {
"supergroup": "Hi! I'm Susie, a moderation and group management bot. I can only manage supergroups. To promote this group to a supergroup, make the group public or promote any member to a full admin and try to /start me again.",
"channel": "The channel id is ",
Expand All @@ -198,7 +198,7 @@
"Topics1": "ℹ️ *Topics* ℹ️\n\nTopics allow large groups to focus discussion in dedicated **topic** chats. Susie supports topics. When changing a group to topic mode, you will need to /start Susie again.\n\n*Admin commands*:\n- `/start`: Start topic mode.",
"Evidence1": "🔍 *Evidence* 🔍\n\nTo prevent important messages from deletion, pre-emptively, messages can be saved as evidence.\n\n*User commands*:\n- `/evidence` <by reply>: Saves message as evidence.",
"Report1": "🚨 *Report* 🚨\n\nReports create content moderation questions on the crowdsourcing platform Reality.Eth asking,\n\n***Did the user break the rules?***\n\nThe question can be answered yes/no with a bond (1 xDAI). Answers can be disputed in the Kleros court.\n\nSuccessful reports result in escalating penalties (1 day, 10 days, 100 days, and finally permanent ban).\n\n*User commands*:\n- `/report` <by reply>: Reports message.\n- `/info`: Returns active reports\n\n*Admin commands*:\n-`/adminreportable` Toggles reportability of admins.\n- `/trial` Toggles trial mode where users are not penalized",
"Rules1": "📄 *Rules* 📄\n\nEvery groups starts with [default rules](https://ipfs.kleros.io/ipfs/Qme3Qbj9rKUNHUe9vj9rqCLnTVUCWKy2YfveQF8HiuWQSu/Kleros%20Moderate%20Community%20Rules.pdf).\n\n***Rule Writing Tips***:\n\n- State the group culture in a preamble.\n- Number each rule.\n- Be specific.\n\n*User commands*:\n- `/rules`: Returns current rules\n*Admin commands*:\n- `/setrules` <by reply> or <url>: Sets the rules to the url or message",
"Rules1": "📄 *Rules* 📄\n\nEvery groups starts with [default rules](https://cdn.kleros.link/ipfs/Qme3Qbj9rKUNHUe9vj9rqCLnTVUCWKy2YfveQF8HiuWQSu/Kleros%20Moderate%20Community%20Rules.pdf).\n\n***Rule Writing Tips***:\n\n- State the group culture in a preamble.\n- Number each rule.\n- Be specific.\n\n*User commands*:\n- `/rules`: Returns current rules\n*Admin commands*:\n- `/setrules` <by reply> or <url>: Sets the rules to the url or message",
"Court1": "⚖️ *Court* ⚖️\n\nModeration questions are resolved by the [Kleros Court](https://kleros.gitbook.io/docs/) with a jury of moderators. If the jury made a mistake, the case can be appealed, drawing a larger pool of jurors and providing an opportunity to provide more context, analysis, and arguments.\n\nIf you would like a chance to serve as a jury member, get PNK ([Gnosis Chain](https://swapr.eth.link/#/swap?chainId=100) or [Mainnet](https://app.uniswap.org/#/swap?outputCurrency=0x93ed3fbe21207ec2e8f2d3c3de6e058cb73bc04d&inputCurrency=ETH)) and [stake](https://court.kleros.io/) in the Kleros court.\n\nTo discuss the merits of a dispute, see @klerosjuror. To learn more about Kleros, ask a question in @Kleros",
"Lawyer1": "🧑‍⚖️ *Find a Lawyer* 🧑‍⚖️\n\nDisputes over content moderation questions can be complicated.\n\nIf you need help arguing your case in the Kleros court, consider asking help from a Kleros [lawyer](https://t.me/+9fvGGkGfSZ1hZDBk).",
"Privacy1": "🕵️ *Privacy* 🕵️\n\nTo provide context, users can request Susie to save messages to submit as evidence on their behalf. Susie manages moderation private and public groups differently,\n\n- ***Private Groups***: Moderators depend on evidence submissions alone.\n\n- ***Public Groups***: Moderators have access to the full public chat history.",
Expand Down Expand Up @@ -382,7 +382,7 @@
"welcome": {
"welcome": "Hola, soy Susie, un bot [Kleros Moderate](https://kleros.io/moderate/). Necesito permiso de un administrador para /start. ¿Cómo puedo ayudar con la moderación?\n\n 1. Pregunto\n\n'¿Un usuario ha infringido las normas?'n\n\nen la plataforma de crowdsourcing [Reality.Eth](https://realityeth.github.io/).\n2. La pregunta se responde con un juego de escalada usando xDai en [Gnosis Chain](https://www.gnosis.io/).\n3. La respuesta se puede disputar en el tribunal [Kleros](https://kleros.io/).\n\nPara saber más, [DM](https://t.me/SusieTheKlerosModeratorBot?start=help), lee mis [docs](https://kleros.gitbook.io/docs/products/moderate/susie), o haz una pregunta en @SusieSupport."
},
"defaultRules": "https://ipfs.kleros.io/ipfs/QmSHAjfD1MYPtyopFoXcUQ5Ny3sfs5re1yz3h3TZ5qGDsp/Kleros%20Moderate%20Normas%20comunitarias.pdf",
"defaultRules": "https://cdn.kleros.link/ipfs/QmSHAjfD1MYPtyopFoXcUQ5Ny3sfs5re1yz3h3TZ5qGDsp/Kleros%20Moderate%20Normas%20comunitarias.pdf",
"help": {
"DM": "Obtener ayuda (DM)",
"DM2": "DM de ayuda : )",
Expand All @@ -393,7 +393,7 @@
"Topics1": "ℹ️ *Temas* ℹ️\n\nLos temas permiten a los grandes grupos centrar el debate en chats dedicados a **temas**. Susie es compatible con los temas. Cuando cambie un grupo a modo de tema, necesitará /iniciar Susie de nuevo.\n\n*Comandos de administrador*:\n- `/start`: Inicia el modo por temas.",
"Evidence1": "🔍 *Evidencia* 🔍\n\nPara evitar que se borren mensajes importantes, de forma preventiva, se pueden guardar mensajes como evidencia.\n\n*Comandos de usuario*:\n- `/evidence` <por respuesta>: Guarda el mensaje como evidencia.",
"Report1": "🚨 *Denuncia* 🚨 \n\nLas denuncias crean preguntas de moderación de contenidos en la plataforma de crowdsourcing Reality.Eth preguntando,\n\n'¿el usuario infringió las normas?'\n\nLa pregunta puede responderse sí/no con un bono (1 xDAI). Las respuestas pueden ser impugnadas en el tribunal Kleros.\n\nLas denuncias exitosos resultan en sanciones escalonadas (1 día, 10 días, 100 días, y finalmente prohibición permanente).\n\n*Comandos de usuario*:\n- `/report` <por respuesta>: Informa del mensaje.\n- `/info`: Devuelve las denuncias activos.n\n*Comandos de administrador*:\n-`/adminreportable` Activa la posibilidad de informar de los administradores.\n- `/trial` Activa el modo de prueba en el que los usuarios no son penalizados.",
"Rules1": "📄 *Reglas* 📄\n\nTodos los grupos empiezan con [reglas por defecto](https://ipfs.kleros.io/ipfs/QmSHAjfD1MYPtyopFoXcUQ5Ny3sfs5re1yz3h3TZ5qGDsp/Kleros%20Moderate%20Normas%20comunitarias.pdf). \n\n***Consejos para la redacción de reglas***:\n\n -Enuncie la cultura del grupo en un preámbulo.\n -Numere cada regla.\nSea específico.\n\n*Comandos de usuario*:\n-`/rules`: Devuelve las reglas.\n*Comandos de administrador*:\n- `/setrules` <by reply> o <url>: Establece las reglas a la url o mensaje.",
"Rules1": "📄 *Reglas* 📄\n\nTodos los grupos empiezan con [reglas por defecto](https://cdn.kleros.link/ipfs/QmSHAjfD1MYPtyopFoXcUQ5Ny3sfs5re1yz3h3TZ5qGDsp/Kleros%20Moderate%20Normas%20comunitarias.pdf). \n\n***Consejos para la redacción de reglas***:\n\n -Enuncie la cultura del grupo en un preámbulo.\n -Numere cada regla.\nSea específico.\n\n*Comandos de usuario*:\n-`/rules`: Devuelve las reglas.\n*Comandos de administrador*:\n- `/setrules` <by reply> o <url>: Establece las reglas a la url o mensaje.",
"Court1": "⚖️ *Corte* ⚖️\n\nLas preguntas de moderación las resuelve el [Kleros Court](https://kleros.gitbook.io/docs/) con un jurado de moderadores. Si el jurado cometió un error, el caso puede ser apelado, atrayendo a un grupo más grande de miembros del jurado y proporcionando la oportunidad de proporcionar más contexto, análisis y argumentos.\n\nSi desea tener la oportunidad de servir como miembro del jurado, obtenga PNK ([Gnosis Chain](https://swapr.eth.link/#/swap?chainId=100) o [Mainnet](https://app.uniswap.org/#/swap?outputCurrency=0x93ed3fbe21207ec2e8f2d3c3de6e058cb73bc04d&inputCurrency=ETH)) y [stake](https://court.kleros.io/) en el tribunal de Kleros.\n\nPara discutir el fondo de una disputa, consulte @klerosjuror.",
"Lawyer1": "🧑‍⚖️ *Busque un abogado* 🧑‍⚖️ \n\nLas disputas sobre denuncias pueden ser complicadas.\n\nSi necesita ayuda para defender su caso ante el tribunal kleros, considere pedir ayuda a un [abogado] kleros(https://t.me/+9fvGGkGfSZ1hZDBk).",
"Privacy1": "🕵️ *Privacidad* 🕵️\n\nPara proporcionar contexto, los usuarios pueden solicitar a Susie que guarde mensajes para presentarlos como evidencia en su nombre. Susie gestiona la moderación de grupos privados y públicos de forma diferente,\n\n- *** Grupos Privados ***: Los moderadores dependen únicamente de las evidencia presentadas\n\n- *** Grupos Públicos ***: Los moderadores tienen acceso a todo el historial del chat público.",
Expand Down
2 changes: 1 addition & 1 deletion lib/telegram/commands/addEvidence.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ const processCommand = async (queue: any, bot: any, settings: groupSettings, msg
const evidenceJsonPath = await uploadEvidenceJson(settings.lang, msg, evidencePath,isPrivate);
try{
queue.add(async () => {try{
const resp = await bot.sendMessage(msg.chat.id, `${langJson[settings.lang].addevidence.submitted}(https://ipfs.kleros.io${evidencePath}).`, msg.is_topic_message? {parse_mode: "Markdown", message_thread_id: msg.message_thread_id, disable_web_page_preview: true}:{parse_mode: "Markdown", disable_web_page_preview: true})
const resp = await bot.sendMessage(msg.chat.id, `${langJson[settings.lang].addevidence.submitted}(https://cdn.kleros.link${evidencePath}).`, msg.is_topic_message? {parse_mode: "Markdown", message_thread_id: msg.message_thread_id, disable_web_page_preview: true}:{parse_mode: "Markdown", disable_web_page_preview: true})
return resp.message_id}catch{}});
} catch(e){
console.log(e)
Expand Down
4 changes: 2 additions & 2 deletions lib/telegram/commands/help.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ const helpnotifications = (queue: any, db: any, settings: groupSettings, bot: an
const lang_code = msg?.from?.language_code
try{
queue.add(async () => {try{await bot.sendMessage(msg.chat.id, langJson[lang_code].help.Notifications1,{parse_mode: 'Markdown', disable_web_page_preview: true})}catch{}})
//queue.add(async () => {try{await bot.sendVideo(msg.chat.id, `https://ipfs.kleros.io/ipfs/QmaWKFxR8TNzWW1xDuzXe4XFE5wCFJVuFP6AKCQ3LRAQqB/Screen%20Recording%202022-12-13%20at%209.19.17%20PM(1).mp4`));
//queue.add(async () => {try{await bot.sendVideo(msg.chat.id, `https://cdn.kleros.link/ipfs/QmaWKFxR8TNzWW1xDuzXe4XFE5wCFJVuFP6AKCQ3LRAQqB/Screen%20Recording%202022-12-13%20at%209.19.17%20PM(1).mp4`));
} catch(e){
console.log(e)
}
Expand Down Expand Up @@ -228,7 +228,7 @@ const respond = (queue: any, settings: groupSettings, bot: any, helpType: string
break;
}
case 'court': {
//https://ipfs.kleros.io/ipfs/QmZwVBdfALRWbjCLtLNSq9YceADCtP96hfPkg3Y6f6xWJk/KlerosModerate.png
//https://cdn.kleros.link/ipfs/QmZwVBdfALRWbjCLtLNSq9YceADCtP96hfPkg3Y6f6xWJk/KlerosModerate.png
queue.add(async () => {try{await bot.editMessageText(langJson[lang_code].help.Court1,optsResponse)}catch{}})
break;
}
Expand Down
2 changes: 1 addition & 1 deletion lib/telegram/commands/report.ts
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ const callback = async (queue: any, db:any, settings: groupSettings, bot: Telegr
return
const isPrivate = !chatobj.active_usernames;
const evidencepath = await upload(queue, bot, settings.lang, msg, isPrivate);
const msgBackup = 'https://ipfs.kleros.io'+evidencepath;
const msgBackup = 'https://cdn.kleros.link'+evidencepath;
// TODO report
const reportAllowance = getAllowance(db, 'telegram', String(msg.chat.id), String(msg.from.id));
console.log(reportAllowance)
Expand Down
2 changes: 1 addition & 1 deletion lib/telegram/commands/setChannel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ const callback = async (queue: any, db: any, settings: groupSettings, bot: Teleg
if(!channelUserSusie)
return
if (channelUserSusie.status !== "administrator"){
const resp = await queue.add(async () => {try{const val = await bot.sendVideo(msg.chat.id, 'https://ipfs.kleros.io/ipfs/QmbnEeVzBjcAnnDKGYJrRo1Lx2FFnG62hYfqx4fLTqYKC7/guide.mp4', {caption: langJson[settings.lang].errorAdminRights})
const resp = await queue.add(async () => {try{const val = await bot.sendVideo(msg.chat.id, 'https://cdn.kleros.link/ipfs/QmbnEeVzBjcAnnDKGYJrRo1Lx2FFnG62hYfqx4fLTqYKC7/guide.mp4', {caption: langJson[settings.lang].errorAdminRights})
return val}catch{}});
if(!resp)
return
Expand Down
2 changes: 1 addition & 1 deletion lib/telegram/commands/setChannelFed.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ const callback = async (queue: any, db: any, settings: groupSettings, bot: any,
if(!channelUserSusie)
return
if (channelUserSusie.status !== "administrator"){
const resp = await queue.add(async () => {try{const val = await bot.sendVideo(msg.chat.id, 'https://ipfs.kleros.io/ipfs/QmbnEeVzBjcAnnDKGYJrRo1Lx2FFnG62hYfqx4fLTqYKC7/guide.mp4', {caption: langJson[settings.lang].errorAdminRights},msg.chat.is_forum? {message_thread_id: msg.message_thread_id, parse_mode: 'Markdown'} : {parse_mode: 'Markdown'})
const resp = await queue.add(async () => {try{const val = await bot.sendVideo(msg.chat.id, 'https://cdn.kleros.link/ipfs/QmbnEeVzBjcAnnDKGYJrRo1Lx2FFnG62hYfqx4fLTqYKC7/guide.mp4', {caption: langJson[settings.lang].errorAdminRights},msg.chat.is_forum? {message_thread_id: msg.message_thread_id, parse_mode: 'Markdown'} : {parse_mode: 'Markdown'})
return val}catch{}});
if(!resp)
return
Expand Down
4 changes: 2 additions & 2 deletions lib/telegram/commands/setRules.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ const callback = async (queue: any, db: any, settings: groupSettings, bot: any,
const msg_id = msg.chat.is_forum? msg.is_topic_message? msg.message_thread_id: 1 : ''+msg.reply_to_message.message_id;
const MsgLink = 'https://t.me/c/' + String(msg.chat.id).substring(4) + '/' + msg_id;

setRulesCustom(db, 'telegram', String(msg.chat.id), 'https://ipfs.kleros.io'+rulesPath, Math.floor(Date.now()/1000), msg_id);
queue.add(async () => {try{await bot.sendMessage(msg.chat.id, `${langJson[settings.lang].rulesUpdated}(https://ipfs.kleros.io${rulesPath}).`, msg.chat.is_forum? {message_thread_id: settings.thread_id_rules, parse_mode: 'Markdown'}: {parse_mode: "Markdown"})}catch{}});
setRulesCustom(db, 'telegram', String(msg.chat.id), 'https://cdn.kleros.link'+rulesPath, Math.floor(Date.now()/1000), msg_id);
queue.add(async () => {try{await bot.sendMessage(msg.chat.id, `${langJson[settings.lang].rulesUpdated}(https://cdn.kleros.link${rulesPath}).`, msg.chat.is_forum? {message_thread_id: settings.thread_id_rules, parse_mode: 'Markdown'}: {parse_mode: "Markdown"})}catch{}});
if(msg.chat.is_forum){
const msgRules = await queue.add(async () => {try{const val = await bot.forwardMessage(msg.chat.id, msg.chat.id, msg.reply_to_message.message_id, {message_thread_id: settings.thread_id_rules})
return val}catch{}});
Expand Down
Loading
Loading