node-red-contrib-telegrambot
Version:
141 lines (125 loc) • 4.97 kB
HTML
<!-- Created by Karl-Heinz Wind -->
<!-- ------------------------------------------------------------------------------------------ -->
<script type="text/javascript">
RED.nodes.registerType('telegram bot', {
category: 'config',
defaults: {
botname: { value: "fooBot", required: true }
},
credentials: {
token: { type: "text" }
},
label: function () {
return this.botname;
}
});
</script>
<script type="text/x-red" data-template-name="telegram bot">
<div class="form-row">
<label for="node-config-input-botname"><i class="icon-bookmark"></i> Bot-Name</label>
<input type="text" id="node-config-input-botname">
</div>
<div class="form-row">
<label for="node-config-input-token"><i class="icon-bookmark"></i> Token</label>
<input type="text" id="node-config-input-token">
</div>
</script>
<script type="text/x-red" data-help-name="telegram bot">
<p>A configuration node that holds the token of the telegram bot.</p>
</script>
<!-- ------------------------------------------------------------------------------------------ -->
<script type="text/javascript">
RED.nodes.registerType('telegram receiver', {
category: 'telegram',
color: '#a6bbcf',
defaults: {
name: { value: "" },
bot: { value:"", type: "telegram bot", required: true }
},
inputs: 0,
outputs: 1,
icon: "feed.png",
label: function () {
return this.name || "Telegram Receiver";
}
});
</script>
<script type="text/x-red" data-template-name="telegram receiver">
<div class="form-row">
<label for="node-input-name"><i class="icon-tag"></i> Name</label>
<input type="text" id="node-input-name" placeholder="Name">
</div>
<div class="form-row">
<label for="node-input-bot"><i class="icon-tag"></i> Bot</label>
<input type="text" id="node-input-bot" placeholder="Bot">
</div>
</script>
<script type="text/x-red" data-help-name="telegram receiver">
<p>A telegram node that triggers the output when some message is received from the chat.</p>
</script>
<!-- ------------------------------------------------------------------------------------------ -->
<script type="text/javascript">
RED.nodes.registerType('telegram command', {
category: 'telegram',
color: '#a6bbcf',
defaults: {
name: { value: "" },
command: { value: ""},
bot: { value: "", type: "telegram bot", required: true }
},
inputs: 0,
outputs: 2,
icon: "arrow-in.png",
label: function () {
return this.name || "Telegram Command";
}
});
</script>
<script type="text/x-red" data-template-name="telegram command">
<div class="form-row">
<label for="node-input-name"><i class="icon-tag"></i> Name</label>
<input type="text" id="node-input-name" placeholder="Name">
</div>
<div class="form-row">
<label for="node-input-command"><i class="icon-tag"></i> Command</label>
<input type="text" id="node-input-command" placeholder="Command">
</div>
<div class="form-row">
<label for="node-input-bot"><i class="icon-tag"></i> Bot</label>
<input type="text" id="node-input-bot" placeholder="Bot">
</div>
</script>
<script type="text/x-red" data-help-name="telegram command">
<p>A telegram node that triggers the output when a specified command is received from the chat.</p>
</script>
<!-- ------------------------------------------------------------------------------------------ -->
<script type="text/javascript">
RED.nodes.registerType('telegram sender', {
category: 'telegram',
color: '#a6bbcf',
defaults: {
name: { value: "" },
bot: { value: "", type: "telegram bot", required: true }
},
inputs: 1,
outputs: 0,
icon: "feed.png",
label: function () {
return this.name || "Telegram Sender";
}
});
</script>
<script type="text/x-red" data-template-name="telegram sender">
<div class="form-row">
<label for="node-input-name"><i class="icon-tag"></i> Name</label>
<input type="text" id="node-input-name" placeholder="Name">
</div>
<div class="form-row">
<label for="node-input-bot"><i class="icon-tag"></i> Bot</label>
<input type="text" id="node-input-bot" placeholder="Bot">
</div>
</script>
<script type="text/x-red" data-help-name="telegram sender">
<p>A telegram node that sends the content to the chat.</p>
</script>
<!-- ------------------------------------------------------------------------------------------ -->