autoParseChatId static method

dynamic autoParseChatId(
  1. dynamic data
)

Implementation

static dynamic autoParseChatId(dynamic data) {
  try {
    try {
      return num.parse(data).toInt();
    } catch (e) {}
    if (data is String) {
      if (RegExp("([a-z_0-9]+)", caseSensitive: false).hasMatch(data)) {
        return "@${data.replaceAll(RegExp("(@)", caseSensitive: false), "").trim()}";
      }
    }
  } catch (e) {}
  return 0;
}