@bot.command()
async def Dota(ctx):
if ctx.channel.id == ID_КАНАЛА:
await ctx.send('Вы получили роль "Дотер"')
author = ctx.message.author
guild = bot.get_guild(984403171743006740)
role = guild.get_role(1091398609020387380)
await author.add_roles(role)
else:
await ctx.send('Эта команда может быть использована только в определенном канале')@bot.command()
async def DelDota(ctx):
if ctx.channel.id == ID_КАНАЛА:
await ctx.send('У вас забрали роль "Дотер"')
author = ctx.message.author
guild = bot.get_guild(984403171743006740)
role = guild.get_role(1091398609020387380)
await author.remove_roles(role)
else:
await ctx.send('Эта команда может быть использована только в определенном канале')
uses GraphWPF, WPFObjects, Controls;
begin
Window.Width := 640;
Window.Height := 480;
var r := new RectangleWPF (0.0, 0.0, 640.0, 480.0); // создаем прямоугольник
r.Color := RGB (0, 0, 0); // задаем ему цвет
r.ZIndex := -1; // задаем ему ZIndex равный -1
var t := TextBox (''); // создаем TextBox
t.ZIndex := 1; // задаем ему ZIndex равный 1
end.
const targetNavbar = document.querySelector('.targetNavbar');
const fixedNavbar = document.querySelector('.fixedNavbar');
const obFixedNavbar = new IntersectionObserver(obCallback);
function obCallback(payload) {
if (payload[0].boundingClientRect.y < 0) {
document.querySelector('.class1').style.marginBottom
= fixedNavbar.offsetHeight + 'px';
fixedNavbar.classList.add('class2');
} else {
fixedNavbar.classList.remove('class2');
document.querySelector('.class1').style.marginBottom = '0';
}
}
obFixedNavbar.observe(targetNavbar);
window.addEventListener('resize', () => {
obFixedNavbar.disconnect()
;
obFixedNavbar.observe(targetNavbar);
});
=> {
dispatch(setCanvas(canvasRef.current));
dispatch(setTool(new Brush(canvas)));
console.log('canvas from board', canvas);
console.log('tool', tool);
}, [dispatch]);=> {
dispatch(setCanvas(canvasRef.current));
}, [dispatch, canvasRef.current]);
useEffect(() => {
dispatch(setTool(new Brush(canvas)));
}, [dispatch, canvas]);canvas = useSelector((state) => state.canvas.canvas || {});
const tool = useSelector((state) => state.tool || {});
import React, { useRef, useEffect } from 'react';
import './Board.scss';
import { useSelector, useDispatch } from 'react-redux';
import { setCanvas } from '../../store/canvasSlice';
import { setTool } from '../../store/toolSlice';
import Brush from '../../tools/Brush';
export const Board = () => {
const canvasRef = useRef();
const canvas = useSelector((state) => state.canvas.canvas);
const tool = useSelector((state) => state.tool);
const dispatch = useDispatch();
useEffect(() => {
dispatch(setCanvas(canvasRef.current));
dispatch(setTool(new Brush(canvas)));
}, [canvas, dispatch, tool]);
return <canvas ref={canvasRef} className='board' width={1920} height={1080}></canvas>;
};
var j = 1;
var id = setInterval(remove, 100);
function remove() {
$('.i-am-os[data-id="' + j + '"]').animate({
opacity: '0',
color: '#00000000'
}, 100, function () {
$(this).remove()
});
j++;
if (j > 22) {
clearInterval(id);
}
}
with open("/var/www/html/file.txt", "a") as f:
f.write("123")
from vkbottle import GroupEventType, Message
from vkbottle.bot import Bot
# replace GROUP_CHAT_ID with the ID of your group chat
GROUP_CHAT_ID = 123456789
bot = Bot("TOKEN")
@bot.on.message_handler(GroupEventType.WALL_POST_NEW)
async def wall_post_new(message: Message):
try:
await bot.api.messages.send(
peer_id=-GROUP_CHAT_ID, # use negative group chat ID to indicate a group chat
message="Новый пост!",
random_id=0,
attachment=f"wall-{message.group_id}_{message.object.id}"
)
except Exception as ex:
print(f"error: {ex}")
from vkbottle import GroupEventType, Message
from vkbottle.bot import Bot
@bot.on.message_handler(GroupEventType.WALL_POST_NEW)
async def wall_post_new(message: Message):
conversations = await bot.api.messages.get_conversations(peer_types=["chat"])
for conv in conversations:
peer_id = conv.peer.id # access the 'id' attribute of the 'peer' object
try:
await bot.api.messages.send(
peer_id=peer_id,
message='Новый пост!',
random_id=0,
attachment=f'wall-{message.group_id}_{message.object.id}'
)
except Exception as ex:
print(f'error: {ex}')
from vkbottle import GroupEventType, Message
@bot.on.message_handler(GroupEventType.WALL_POST_NEW)
async def wall_post_new(message: Message):
conversations = await bot.api.messages.get_conversations(peer_types=["chat"])
for conv in conversations.items:
peer_id = conv.peer.id # access the 'id' attribute of the 'peer' object
try:
await bot.api.messages.send(
peer_id=peer_id,
message='Новый пост!',
random_id=0,
attachment=f'wall-{event.group_id}_{event.object.id}'
)
except Exception as ex:
print(f'error: {ex}')
from vkbottle import GroupEventType, Message
@bot.on.message_handler(GroupEventType.WALL_POST_NEW)
async def wall_post_new(message: Message):
conversations = await bot.api.messages.get_conversations(peer_types=["chat"])
for conv in conversations.items:
peer_id = conv.peer_id
try:
await bot.api.messages.send(
peer_id=peer_id,
message='Новый пост!',
random_id=0,
attachment=f'wall-{event.group_id}_{event.object.id}'
)
except Exception as ex:
print(f'error: {ex}')