diff --git a/.github/ISSUE_TEMPLATE/adapter_publish.yml b/.github/ISSUE_TEMPLATE/adapter_publish.yml new file mode 100644 index 00000000..6aa3ec85 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/adapter_publish.yml @@ -0,0 +1,57 @@ +name: 发布适配器 +title: "Adapter: {name}" +description: 发布适配器到 NoneBot 官方商店 +labels: ["Adapter"] +body: + - type: input + id: name + attributes: + label: 适配器名称 + description: 适配器名称 + validations: + required: true + + - type: input + id: description + attributes: + label: 适配器描述 + description: 适配器描述 + validations: + required: true + + - type: input + id: pypi + attributes: + label: PyPI 项目名 + description: PyPI 项目名 + placeholder: e.g. nonebot-adapter-xxx + validations: + required: true + + - type: input + id: module + attributes: + label: 适配器 import 包名 + description: 适配器 import 包名 + placeholder: e.g. nonebot_adapter_xxx + validations: + required: true + + - type: input + id: homepage + attributes: + label: 适配器项目仓库/主页链接 + description: 适配器项目仓库/主页链接 + placeholder: e.g. https://github.com/xxx/xxx + validations: + required: true + + - type: input + id: tags + attributes: + label: 标签 + description: 标签 + placeholder: 'e.g. [{"label": "标签名", "color": "#ea5252"}]' + value: "[]" + validations: + required: true diff --git a/.github/ISSUE_TEMPLATE/bot_publish.yml b/.github/ISSUE_TEMPLATE/bot_publish.yml new file mode 100644 index 00000000..f4495b5a --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bot_publish.yml @@ -0,0 +1,37 @@ +name: 发布机器人 +title: "Bot: {name}" +description: 发布机器人到 NoneBot 官方商店 +labels: ["Bot"] +body: + - type: input + id: name + attributes: + label: 机器人名称 + description: 机器人名称 + validations: + required: true + + - type: input + id: description + attributes: + label: 机器人描述 + description: 机器人描述 + validations: + required: true + + - type: input + id: homepage + attributes: + label: 机器人项目仓库/主页链接 + description: 机器人项目仓库/主页链接 + placeholder: e.g. https://github.com/xxx/xxx + + - type: input + id: tags + attributes: + label: 标签 + description: 标签 + placeholder: 'e.g. [{"label": "标签名", "color": "#ea5252"}]' + value: "[]" + validations: + required: true diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml index 849cbdfe..352b01aa 100644 --- a/.github/ISSUE_TEMPLATE/config.yml +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -1,14 +1,5 @@ -blank_issues_enabled: true +blank_issues_enabled: false contact_links: - - name: Question + - name: NoneBot 论坛 url: https://discussions.nonebot.dev/ - about: Ask questions about nonebot - - name: Plugin Publish - url: https://v2.nonebot.dev/store - about: Publish your plugin to nonebot homepage and nb-cli - - name: Adapter Publish - url: https://v2.nonebot.dev/store - about: Publish your adapter to nonebot homepage and nb-cli - - name: Bot Publish - url: https://v2.nonebot.dev/store - about: Publish your bot to nonebot homepage and nb-cli + about: 前往 NoneBot 论坛提问 diff --git a/.github/ISSUE_TEMPLATE/plugin_publish.yml b/.github/ISSUE_TEMPLATE/plugin_publish.yml new file mode 100644 index 00000000..ec56986c --- /dev/null +++ b/.github/ISSUE_TEMPLATE/plugin_publish.yml @@ -0,0 +1,57 @@ +name: 发布插件 +title: "Plugin: {name}" +description: 发布插件到 NoneBot 官方商店 +labels: ["Plugin"] +body: + - type: input + id: name + attributes: + label: 插件名称 + description: 插件名称 + validations: + required: true + + - type: input + id: description + attributes: + label: 插件描述 + description: 插件描述 + validations: + required: true + + - type: input + id: pypi + attributes: + label: PyPI 项目名 + description: PyPI 项目名 + placeholder: e.g. nonebot-plugin-xxx + validations: + required: true + + - type: input + id: module + attributes: + label: 插件 import 包名 + description: 插件 import 包名 + placeholder: e.g. nonebot_plugin_xxx + validations: + required: true + + - type: input + id: homepage + attributes: + label: 插件项目仓库/主页链接 + description: 插件项目仓库/主页链接 + placeholder: e.g. https://github.com/xxx/xxx + validations: + required: true + + - type: input + id: tags + attributes: + label: 标签 + description: 标签 + placeholder: 'e.g. [{"label": "标签名", "color": "#ea5252"}]' + value: "[]" + validations: + required: true diff --git a/website/src/components/Adapter.tsx b/website/src/components/Adapter.tsx index fd28affe..71fe3c8d 100644 --- a/website/src/components/Adapter.tsx +++ b/website/src/components/Adapter.tsx @@ -41,42 +41,27 @@ export default function Adapter(): JSX.Element { const [label, setLabel] = useState(""); const [color, setColor] = useState("#ea5252"); + const urlEncode = (str: string) => + encodeURIComponent(str).replace(/%2B/gi, "+"); + const onSubmit = () => { setModalOpen(false); - const title = encodeURIComponent(`Adapter: ${form.name}`).replace( - /%2B/gi, - "+" - ); - const body = encodeURIComponent( - ` -**协议名称:** - -${form.name} - -**协议功能:** - -${form.desc} - -**PyPI 项目名:** - -${form.projectLink} - -**协议 import 包名:** - -${form.moduleName} - -**协议项目仓库/主页链接:** - -${form.homepage} - -**标签:** - -${JSON.stringify(tags)} -`.trim() - ).replace(/%2B/gi, "+"); - window.open( - `https://github.com/nonebot/nonebot2/issues/new?title=${title}&body=${body}&labels=Adapter` - ); + const queries: { key: string; value: string }[] = [ + { key: "template", value: "adapter_publish.yml" }, + { key: "title", value: form.name && `Adapter: ${form.name}` }, + { key: "labels", value: "Adapter" }, + { key: "name", value: form.name }, + { key: "description", value: form.desc }, + { key: "pypi", value: form.projectLink }, + { key: "module", value: form.moduleName }, + { key: "homepage", value: form.homepage }, + { key: "tags", value: JSON.stringify(tags) }, + ]; + const urlQueries = queries + .filter((query) => !!query.value) + .map((query) => `${query.key}=${urlEncode(query.value)}`) + .join("&"); + window.open(`https://github.com/nonebot/nonebot2/issues/new?${urlQueries}`); }; const onChange = (event) => { const target = event.target; diff --git a/website/src/components/Bot.tsx b/website/src/components/Bot.tsx index c7f3dfdf..eaf20349 100644 --- a/website/src/components/Bot.tsx +++ b/website/src/components/Bot.tsx @@ -39,31 +39,25 @@ export default function Bot(): JSX.Element { const [label, setLabel] = useState(""); const [color, setColor] = useState("#ea5252"); + const urlEncode = (str: string) => + encodeURIComponent(str).replace(/%2B/gi, "+"); + const onSubmit = () => { setModalOpen(false); - const title = encodeURIComponent(`Bot: ${form.name}`).replace(/%2B/gi, "+"); - const body = encodeURIComponent( - ` -**机器人名称:** - -${form.name} - -**机器人功能:** - -${form.desc} - -**机器人项目仓库/主页链接:** - -${form.homepage} - -**标签:** - -${JSON.stringify(tags)} -`.trim() - ).replace(/%2B/gi, "+"); - window.open( - `https://github.com/nonebot/nonebot2/issues/new?title=${title}&body=${body}&labels=Bot` - ); + const queries: { key: string; value: string }[] = [ + { key: "template", value: "bot_publish.yml" }, + { key: "title", value: form.name && `Bot: ${form.name}` }, + { key: "labels", value: "Bot" }, + { key: "name", value: form.name }, + { key: "description", value: form.desc }, + { key: "homepage", value: form.homepage }, + { key: "tags", value: JSON.stringify(tags) }, + ]; + const urlQueries = queries + .filter((query) => !!query.value) + .map((query) => `${query.key}=${urlEncode(query.value)}`) + .join("&"); + window.open(`https://github.com/nonebot/nonebot2/issues/new?${urlQueries}`); }; const onChange = (event) => { const target = event.target; diff --git a/website/src/components/Plugin.tsx b/website/src/components/Plugin.tsx index 3723eef9..a583c3d2 100644 --- a/website/src/components/Plugin.tsx +++ b/website/src/components/Plugin.tsx @@ -41,42 +41,27 @@ export default function Plugin(): JSX.Element { const [label, setLabel] = useState(""); const [color, setColor] = useState("#ea5252"); + const urlEncode = (str: string) => + encodeURIComponent(str).replace(/%2B/gi, "+"); + const onSubmit = () => { setModalOpen(false); - const title = encodeURIComponent(`Plugin: ${form.name}`).replace( - /%2B/gi, - "+" - ); - const body = encodeURIComponent( - ` -**插件名称:** - -${form.name} - -**插件功能:** - -${form.desc} - -**PyPI 项目名:** - -${form.projectLink} - -**插件 import 包名:** - -${form.moduleName} - -**插件项目仓库/主页链接:** - -${form.homepage} - -**标签:** - -${JSON.stringify(tags)} -`.trim() - ).replace(/%2B/gi, "+"); - window.open( - `https://github.com/nonebot/nonebot2/issues/new?title=${title}&body=${body}&labels=Plugin` - ); + const queries: { key: string; value: string }[] = [ + { key: "template", value: "plugin_publish.yml" }, + { key: "title", value: form.name && `Plugin: ${form.name}` }, + { key: "labels", value: "Plugin" }, + { key: "name", value: form.name }, + { key: "description", value: form.desc }, + { key: "pypi", value: form.projectLink }, + { key: "module", value: form.moduleName }, + { key: "homepage", value: form.homepage }, + { key: "tags", value: JSON.stringify(tags) }, + ]; + const urlQueries = queries + .filter((query) => !!query.value) + .map((query) => `${query.key}=${urlEncode(query.value)}`) + .join("&"); + window.open(`https://github.com/nonebot/nonebot2/issues/new?${urlQueries}`); }; const onChange = (event) => { const target = event.target;