mubot-server
Version:
A server for mubot
51 lines (48 loc) • 1.6 kB
HTML
<html lang="en">
<head>
<title>Comment</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
</head>
<body>
<div class="container">
<h2>Post to discord</h2>
<p>Enter your post below and click enter.</p>
<form id="form">
<div class="form-group">
<label for="channel">Channel</label>
<select class="form-control" id="channel" name="channel">
<option value='328708919746887682'>Cryptinex</option>
<option value='332285076266287104'>Altcoin Investing</option>
</select>
</div>
<div class="form-group">
<label for="comment">Message:</label>
<textarea name="comment" class="form-control" rows="5" id="comment"></textarea>
</div>
</form>
<p />
</div>
</body>
</html>
<script>
$('#comment').keypress((e) => {
if(e.which == 13) {
$.post( "/discord", $("#form").serialize() ).done(function(data){
$('.container').append(
'<div class="alert alert-success alert-dismissable">' +
'<a href="#" class="close" data-dismiss="alert" aria-label="close">×</a>' +
'<strong>Success!</strong> ' + data +
'</div>'
).find('#comment').val('')
})
setTimeout(() => {
$('.alert').fadeOut( "slow", ()=>{})
}, 2000)
}
})
</script>