🎩 You're Invited:Meet the Socket team at Black Hat in Las Vegas, August 3-6.RSVP
Sign In

grammylog

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

grammylog - npm Package Compare versions

Comparing version
1.0.3
to
1.0.4
+4
-5
example/echo.js

@@ -13,9 +13,8 @@ // Minimal Echo Bot

async function log(ctx, next) {
const from = ctx.from;
let message = ctx.message?.text || ctx.channelPost?.text || undefined;
const from = ctx.from || ctx.chat;
const name =
from.last_name === undefined
? from.first_name
: `${from.first_name} ${from.last_name}`;
`${from.first_name || ""} ${from.last_name || ""}`.trim() || ctx.chat.title;
console.log(
`From: ${name} (@${from.username}) ID: ${from.id}\nMessage: ${ctx.message.text}`
`From: ${name} (@${from.username}) ID: ${from.id}\nMessage: ${message}`
);

@@ -22,0 +21,0 @@ await next();

+5
-10
/*!
* grammyLog
* grammYLog
* Copyright(c) 2023

@@ -10,4 +10,2 @@ *

// Log
/*

@@ -19,13 +17,10 @@ PLUGIN CODE

async function log(ctx, next) {
const from = ctx.from;
let message = ctx.message?.text || ctx.channelPost?.text || undefined;
const from = ctx.from || ctx.chat;
const name =
from.last_name === undefined
? from.first_name
: `${from.first_name} ${from.last_name}`;
`${from.first_name || ""} ${from.last_name || ""}`.trim() || ctx.chat.title;
console.log(
`From: ${name} (@${from.username}) ID: ${from.id}\nMessage: ${ctx.message.text}`
`From: ${name} (@${from.username}) ID: ${from.id}\nMessage: ${message}`
);
await next();
}
bot.use(log);
{
"name": "grammylog",
"version": "1.0.3",
"version": "1.0.4",
"description": "Logging plugin for the grammY framework!",

@@ -5,0 +5,0 @@ "directories": {

@@ -0,1 +1,7 @@

/*
GrammYLog Template
*/
require("dotenv").config();

@@ -11,9 +17,8 @@ const { Bot } = require("grammy");

async function log(ctx, next) {
const from = ctx.from;
let message = ctx.message?.text || ctx.channelPost?.text || undefined;
const from = ctx.from || ctx.chat;
const name =
from.last_name === undefined
? from.first_name
: `${from.first_name} ${from.last_name}`;
`${from.first_name || ""} ${from.last_name || ""}`.trim() || ctx.chat.title;
console.log(
`From: ${name} (@${from.username}) ID: ${from.id}\nMessage: ${ctx.message.text}`
`From: ${name} (@${from.username}) ID: ${from.id}\nMessage: ${message}`
);

@@ -20,0 +25,0 @@ await next();