Skip to content

Instantly share code, notes, and snippets.

from typing import Final
from telegram import Update
from telegram.ext import Application, MessageHandler, filters, ContextTypes
TOKEN: Final = 'xxxxxxxx'
BOT_USERNAME: Final = '@Zing259Bot'
async def handle_message(udpate: Update, context: ContextTypes.DEFAULT_TYPE):
message_type: str = udpate.channel_post.chat.type
<?php
namespace App\Traits;
use App\Exceptions\ModelNotFoundException;
use Illuminate\Database\Eloquent\Model as EloquentModel;
trait DatabaseRepositoryTrait
{
/**
@akaamitgupta
akaamitgupta / ClientRepository.php
Last active December 5, 2016 16:40
A Repository Implementation for Eloquent.
<?php
namespace App\Repositories\Eloquent;
use App\Models\Client;
use App\Traits\EloquentRepositoryTrait;
use App\Repositories\Contracts\ClientRepository as ClientRepositoryContract;
class ClientRepository implements ClientRepositoryContract
{
@akaamitgupta
akaamitgupta / PostController.php
Last active December 2, 2016 05:23
Check if any relation exists for a parent node before deleting it so that we don't have any orphan child node.
<?php
/**
* Delete the given post.
*
* @param int $post_id
* @return void
*
* @throws \App\Exceptions\RelationExistsException
*/