AABB
AlignmentBehavior
ArriveBehavior
AStar
BFS
BoundingSphere
BVH
BVHNode
Cell
CellSpacePartitioning
CohesionBehavior
CompositeGoal
ConvexHull
Corridor
CostTable
DFS
Dijkstra
Edge
EntityManager
EvadeBehavior
EventDispatcher
Behavior
FollowPathBehavior
FuzzyAND
FuzzyCompositeTerm
FuzzyFAIRLY
FuzzyModule
FuzzyOR
FuzzyRule
FuzzySet
FuzzyTerm
FuzzyVariable
FuzzyVERY
GameEntity
Goal
GoalEvaluator
Graph
GraphUtils
HalfEdge
HeuristicPolicyDijkstra
HeuristicPolicyEuclid
HeuristicPolicyEuclidSquared
HeuristicPolicyManhattan
InterposeBehavior
LeftSCurveFuzzySet
LeftShoulderFuzzySet
LineSegment
Logger
MathUtils
Matrix3
Matrix4
MemoryRecord
MemorySystem
MeshGeometry
MessageDispatcher
MovingEntity
NavEdge
NavMesh
NavMeshLoader
NavNode
Node
NormalDistFuzzySet
OBB
ObstacleAvoidanceBehavior
OffsetPursuitBehavior
OnPathBehavior
Path
Plane
Polygon
Polyhedron
PriorityQueue
PursuitBehavior
Quaternion
Ray
RectangleTriggerRegion
Regular
RightSCurveFuzzySet
RightShoulderFuzzySet
SAT
SeekBehavior
SeparationBehavior
SingletonFuzzySet
Smoother
SphericalTriggerRegion
State
StateMachine
SteeringBehavior
SteeringManager
Task
TaskQueue
Telegram
Think
Time
TriangularFuzzySet
Trigger
TriggerRegion
Vector3
Vehicle
Version
WanderBehavior

receiver

receiver是一个Yuka js库的Telegram接收器。

该接收器提供了一个提取Telegram消息并传递给Yuka的机制。

安装

使用npm安装receiver:

npm install yuka-receiver

使用

接收器需要Telegram bot的API密钥和你要监听的频道/组的英文名称。

以下是一个简单的例子:

const TelegramReceiver = require('yuka-receiver');
const botToken = '<YOUR-TELEGRAM-BOT-TOKEN>';
const channelName = '<YOUR-TELEGRAM-CHANNEL-NAME>';

const receiver = new TelegramReceiver(botToken, channelName);

receiver.on('message', (message) => {
  console.log(`Received message: ${message.text}`);
});

在上面的例子中,message事件将在接收到新消息时触发。

API

以下是接收器的公共方法和事件:

构造函数

new TelegramReceiver(botToken, channelName)

创建一个新的Telegram接收器对象。

botToken是你的Telegram bot的API密钥。

channelName是要监听的频道/组的英文名称。

事件

message

当接收器从Telegram接收到新消息时触发。

方法

start()

启动接收器。

stop()

停止接收器。

许可证

MIT许可证。