async function getCurrencies() {
let response = await fetch("https://api.github.com/repos/javascript-tutorial/en.javascript.info/commits");
if (!(await response.json())) response = await fetch("https://raw.githubusercontent.com/webdataorg/webdata-api/master/package.json");
const result = await response.json();
}
const criptoValute = ['BTC'];
[{id: 'BHD', current: 0.37699, title: '0,377 бахрейнского динара'},
{id: 'BTC', current: 0.000052198327, title: '0,00 BTC'},
{id: 'XAG', current: 0.0520102, title: '0,05 XAG'},
{id: 'XAU', current: 0.00060038, title: '0,00 XAU'}].filter(x => !criptoValute.includes(x.id));
tts = gTTS(text=answer, lang='ru', lang_check=True)
name = 'voice.ogg'
tts.save(name)
vk_session.method('messages.send', {'chat_id': id, 'attachment': d})
print(9)
a = user_session.method('docs.getUploadServer', {'type': 'audio_message', 'chat_id': id})
print(1)
b = requests.post(a['upload_url'], files = {'file': open('/home/TakeThisGear/myhome/voice.ogg', 'rb')}).json()
print(2)
c = user_session.method('docs.save', {'file': b['file']})[0]
d = 'doc{}_{}'.format(c['owner_id'], c['id'])
vk_session.method('messages.send', {'chat_id': id, 'attachment': d})
$('.comment-form').submit(function(e) {
e.preventDefault();
data = $(this).serializeArray()
var _postid = $(this).attr('data-id');
var _comment = $(this).find('.form-control').val();
var _nodeid = $(this).attr('data-nodeid');
var _parentid = $(this).attr('data-reply-id')
$.ajax({
type: "POST",
url: "{% url 'comment_post' %}",
data: {'post_id': _postid, 'content': _comment, 'parent_id': _parentid || '', 'csrfmiddlewaretoken': '{{ csrf_token }}'},
success: function(response) {
$('.form-comment-'+_postid).val('');
const options = {
year: 'numeric',
month: 'short',
day: 'numeric',
hour12: true,
hour: 'numeric',
minute: '2-digit'
};
let currentdate = new Date().toLocaleString('en-US', options)
var _html =
`<li>
{{ request.user }} <small class="text-muted">${currentdate}</small><br>
${_comment}<br>
<a class="text-decoration-none" data-bs-toggle="collapse" href="#collapseExample" role="button" aria-expanded="false" aria-controls="collapseExample">Ответить</a> <br>
<div class="collapse comment-form" id="collapseExample${_nodeid}">
<form class="comment-form" id="comment-form-{{ node.id }}" data-id="{{ post.id }}" data-reply-id="{{ node.id }}">
<textarea class="form-control" rows="2" cols="40" placeholder="Комментарий" id="comment-text{{ post.id }}" name="comment_content"></textarea>
<button class="btn btn-dark btn-sm mt-1" type="submit">Ответить</button>
</form>
</div>
</li>
${_postid}
`
$(".comment-node-post"+_postid).prepend(_html);
}
});
})
bad_words = ["плохое слово","очень плохое слово"]
@dp.message_handler()
async def filter_messages(message: types.Message):
lower_message = message.text.lower()
for bad_word in bad_words:
if bad_word in lower_message:
await message.delete()
break